[{"data":1,"prerenderedAt":3723},["ShallowReactive",2],{"tutorial:\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective":3,"tutorial-steps:\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective":1321,"kit-\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective":2240,"key-words-glossary":3159,"glossary":3536},{"id":4,"title":5,"body":6,"description":151,"draft":1305,"duration":1306,"extension":1307,"image":1308,"kit":1309,"language":150,"level":1313,"meta":1314,"navigation":209,"path":1315,"pdf":1316,"platform":1317,"seo":1318,"stem":1319,"youtube":151,"__hash__":1320},"tutorials\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002Findex.md","Environment Detective: Exploring Our World with micro:bit",{"type":7,"value":8,"toc":1303},"minimark",[9,1299],[10,11,12,98,104,111,182,261,356,478,585,765,956,1007,1119,1188],"tutorial-steps",{},[13,14,16,20,29,32,56,64,95],"step",{"title":15},"Overview",[17,18,19],"p",{},"Ever wondered how technology can help us understand the world around us?",[17,21,22,23,28],{},"In this project, you are going to become an environment detective using your ",[24,25,27],"g",{"slug":26},"micro-bit","micro:bit"," and its built-in sensors.",[17,30,31],{},"Just like your senses help you explore the world, the micro:bit can tell you:",[33,34,35,43,50],"ul",{},[36,37,38,39],"li",{},"How warm or cold it is using its ",[24,40,42],{"slug":41},"temperature-sensor","temperature sensor",[36,44,45,46],{},"How bright or dark it is using its ",[24,47,49],{"slug":48},"light-sensor","light sensor",[36,51,52,53],{},"Which direction you are facing using its ",[24,54,55],{"slug":55},"compass",[17,57,58,59,63],{},"You will write Python code to make the readings appear on the micro:bit’s ",[24,60,62],{"slug":61},"led-matrix","LED matrix",".",[65,66,69,75],"callout",{"color":67,"icon":68},"green","🎯",[17,70,71],{},[72,73,74],"strong",{},"What you'll learn",[33,76,77,80,83,86,89,92],{},[36,78,79],{},"Read the micro:bit’s temperature sensor",[36,81,82],{},"Display numbers, pictures and letters on the LED matrix",[36,84,85],{},"Detect light levels and make the micro:bit react",[36,87,88],{},"Use the compass to find a direction",[36,90,91],{},"Use Python if statements to make decisions",[36,93,94],{},"Use buttons, shake gestures and variables in your code",[17,96,97],{},"Are you ready? Let’s begin our detective adventure!",[13,99,101],{"title":100},"What you'll need",[102,103],"what-youll-need",{},[13,105,107],{"title":106},"Key words",[108,109],"key-words",{"terms":110},"micro-bit,temperature-sensor,light-sensor,compass,led-matrix,variable,if-statement,comparison-operators",[13,112,114,117,145,162,165,172],{"title":113},"Set up the Python editor",[17,115,116],{},"First, let’s prepare the micro:bit Python editor.",[118,119,120,123,133,136,139,142],"ol",{},[36,121,122],{},"Open your favourite web browser. Google Chrome or Microsoft Edge works well.",[36,124,125,126,63],{},"Go to ",[127,128,132],"a",{"href":129,"rel":130},"https:\u002F\u002Fpython.microbit.org",[131],"nofollow","python.microbit.org",[36,134,135],{},"Close the panel on the left by selecting the arrow pointing left.",[36,137,138],{},"Find the starter code in the main coding area.",[36,140,141],{},"Delete the code from line 5 to line 9.",[36,143,144],{},"Keep this first line:",[146,147,152],"pre",{"className":148,"code":149,"language":150,"meta":151,"style":151},"language-python shiki shiki-themes github-light github-dark","from microbit import *\n","python","",[153,154,155],"code",{"__ignoreMap":151},[156,157,160],"span",{"class":158,"line":159},"line",1,[156,161,149],{},[17,163,164],{},"Your editor should now be ready for your Environment Detective code.",[17,166,167],{},[168,169],"img",{"alt":170,"src":171},"Closing the side panel and clearing the starter code","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FClosingPanel.webp",[65,173,176],{"color":174,"icon":175},"gray","💡",[17,177,178,181],{},[153,179,180],{},"from microbit import *"," gives your Python program access to the micro:bit’s display, buttons, sensors and other tools.",[13,183,185,188,194,217,227,233,239,247],{"title":184},"Prepare your Python code",[17,186,187],{},"We need to prepare the compass and create a loop that keeps checking the sensors.",[17,189,190,191,193],{},"Under ",[153,192,180],{},", type:",[146,195,197],{"className":148,"code":196,"language":150,"meta":151,"style":151},"compass.calibrate()\n\nwhile True:\n",[153,198,199,204,211],{"__ignoreMap":151},[156,200,201],{"class":158,"line":159},[156,202,203],{},"compass.calibrate()\n",[156,205,207],{"class":158,"line":206},2,[156,208,210],{"emptyLinePlaceholder":209},true,"\n",[156,212,214],{"class":158,"line":213},3,[156,215,216],{},"while True:\n",[17,218,219,220,223,224,63],{},"Press ",[72,221,222],{},"Enter"," after ",[153,225,226],{},"while True:",[17,228,229,230,63],{},"The cursor should move inwards automatically. This space at the beginning of the line is called an ",[72,231,232],{},"indent",[17,234,235],{},[168,236],{"alt":237,"src":238},"Setting up the compass and while True loop","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FS1_SettingUpCodeArea.webp",[65,240,242],{"color":174,"icon":241},"🔁",[17,243,244,246],{},[153,245,226],{}," creates a loop. Everything indented underneath it will keep running while the micro:bit is switched on.",[65,248,250,255],{"color":174,"icon":249},"⌨️",[17,251,252],{},[72,253,254],{},"Python punctuation matters",[17,256,257,258,260],{},"Remember to include the colon at the end of ",[153,259,226],{},". Python uses colons and indentation to work out which instructions belong together.",[13,262,264,267,272,298,301,304,310,313,339,345],{"title":263},"Sense the temperature",[17,265,266],{},"First, we will make the micro:bit show the temperature when you shake it.",[17,268,269,270,193],{},"Underneath ",[153,271,226],{},[146,273,275],{"className":148,"code":274,"language":150,"meta":151,"style":151},"    if accelerometer.was_gesture(\"shake\"):\n        display.scroll(temperature())\n        sleep(2000)\n        display.clear()\n",[153,276,277,282,287,292],{"__ignoreMap":151},[156,278,279],{"class":158,"line":159},[156,280,281],{},"    if accelerometer.was_gesture(\"shake\"):\n",[156,283,284],{"class":158,"line":206},[156,285,286],{},"        display.scroll(temperature())\n",[156,288,289],{"class":158,"line":213},[156,290,291],{},"        sleep(2000)\n",[156,293,295],{"class":158,"line":294},4,[156,296,297],{},"        display.clear()\n",[17,299,300],{},"Use four spaces for each level of indentation.",[17,302,303],{},"Your code should look like this:",[17,305,306],{},[168,307],{"alt":308,"src":309},"Python code that displays the temperature after a shake","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FS2_TemperatureSensing.webp",[17,311,312],{},"Here’s what this bit of code is doing:",[33,314,315,321,327,333],{},[36,316,317,320],{},[153,318,319],{},"accelerometer.was_gesture(\"shake\")"," checks whether the micro:bit was shaken.",[36,322,323,326],{},[153,324,325],{},"display.scroll(temperature())"," reads and displays the temperature.",[36,328,329,332],{},[153,330,331],{},"sleep(2000)"," waits for two seconds.",[36,334,335,338],{},[153,336,337],{},"display.clear()"," clears the LED matrix.",[65,340,342],{"color":67,"icon":341},"🌡️",[17,343,344],{},"The micro:bit displays temperature in degrees Celsius.",[65,346,347],{"color":174,"icon":175},[17,348,349,350,353,354,332],{},"The number inside ",[153,351,352],{},"sleep()"," is measured in milliseconds. There are 1,000 milliseconds in one second, so ",[153,355,331],{},[13,357,359,362,372,375,412,415,421,424,442,455,461],{"title":358},"Sense the light level",[17,360,361],{},"Next, we will use button A to check whether the room is dark.",[17,363,364,365,368,369,371],{},"Make sure the new ",[153,366,367],{},"if"," line is aligned with the temperature ",[153,370,367],{}," line.",[17,373,374],{},"Add this code underneath the temperature section:",[146,376,378],{"className":148,"code":377,"language":150,"meta":151,"style":151},"    if button_a.was_pressed():\n        if display.read_light_level() \u003C 100:\n            display.show(Image.HAPPY)\n        else:\n            display.clear()\n        sleep(500)\n",[153,379,380,385,390,395,400,406],{"__ignoreMap":151},[156,381,382],{"class":158,"line":159},[156,383,384],{},"    if button_a.was_pressed():\n",[156,386,387],{"class":158,"line":206},[156,388,389],{},"        if display.read_light_level() \u003C 100:\n",[156,391,392],{"class":158,"line":213},[156,393,394],{},"            display.show(Image.HAPPY)\n",[156,396,397],{"class":158,"line":294},[156,398,399],{},"        else:\n",[156,401,403],{"class":158,"line":402},5,[156,404,405],{},"            display.clear()\n",[156,407,409],{"class":158,"line":408},6,[156,410,411],{},"        sleep(500)\n",[17,413,414],{},"Your light-sensing code should look like this:",[17,416,417],{},[168,418],{"alt":419,"src":420},"Python code that shows a happy face when the light level is below 100","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FS3_LightSensing.webp",[17,422,423],{},"When you press button A:",[33,425,426,429,436,439],{},[36,427,428],{},"The micro:bit reads the light level.",[36,430,431,432,435],{},"If the reading is below ",[153,433,434],{},"100",", it shows a happy face.",[36,437,438],{},"Otherwise, it clears the display.",[36,440,441],{},"It waits for half a second before checking again.",[17,443,444,445,449,450,454],{},"The code uses an ",[24,446,448],{"slug":447},"if-statement","if statement"," and a ",[24,451,453],{"slug":452},"comparison-operators","comparison operator"," to make this decision.",[65,456,458],{"color":174,"icon":457},"🔦",[17,459,460],{},"Cover the micro:bit with your hand and press button A. Then move it somewhere brighter and try again.",[65,462,463],{"color":174,"icon":175},[17,464,465,466,469,470,473,474,477],{},"The ",[153,467,468],{},"\u003C"," symbol means ",[72,471,472],{},"smaller than",". The line ",[153,475,476],{},"display.read_light_level() \u003C 100"," asks whether the light reading is smaller than 100.",[13,479,481,484,487,506,508,514,524,576,582],{"title":480},"Build the compass code",[17,482,483],{},"Now we will use button B to display the compass direction as a number.",[17,485,486],{},"Add this code underneath the button A section:",[146,488,490],{"className":148,"code":489,"language":150,"meta":151,"style":151},"    if button_b.was_pressed():\n        display.scroll(compass.heading())\n        sleep(500)\n",[153,491,492,497,502],{"__ignoreMap":151},[156,493,494],{"class":158,"line":159},[156,495,496],{},"    if button_b.was_pressed():\n",[156,498,499],{"class":158,"line":206},[156,500,501],{},"        display.scroll(compass.heading())\n",[156,503,504],{"class":158,"line":213},[156,505,411],{},[17,507,303],{},[17,509,510],{},[168,511],{"alt":512,"src":513},"Python code that displays the compass heading as a number","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FS4_CompassSensingEasy.webp",[17,515,516,517,520,521,63],{},"When you press button B, the micro:bit will display a number between ",[153,518,519],{},"0"," and ",[153,522,523],{},"359",[525,526,527,541],"table",{},[528,529,530],"thead",{},[531,532,533,537],"tr",{},[534,535,536],"th",{},"Direction",[534,538,540],{"align":539},"right","Compass heading",[542,543,544,552,560,568],"tbody",{},[531,545,546,550],{},[547,548,549],"td",{},"North",[547,551,519],{"align":539},[531,553,554,557],{},[547,555,556],{},"East",[547,558,559],{"align":539},"90",[531,561,562,565],{},[547,563,564],{},"South",[547,566,567],{"align":539},"180",[531,569,570,573],{},[547,571,572],{},"West",[547,574,575],{"align":539},"270",[65,577,579],{"color":174,"icon":578},"🧭",[17,580,581],{},"The compass works like a circle. After 359 degrees, it returns to 0 degrees.",[17,583,584],{},"Test this version before moving on. Once it works, we will replace it with code that displays letters instead.",[13,586,588,591,594,610,613,685,688,694,699,710,719,722,725,754],{"title":587},"Show compass letters",[17,589,590],{},"Numbers are useful, but letters are easier to recognise quickly.",[17,592,593],{},"Remove this version of the button B code:",[146,595,596],{"className":148,"code":489,"language":150,"meta":151,"style":151},[153,597,598,602,606],{"__ignoreMap":151},[156,599,600],{"class":158,"line":159},[156,601,496],{},[156,603,604],{"class":158,"line":206},[156,605,501],{},[156,607,608],{"class":158,"line":213},[156,609,411],{},[17,611,612],{},"Replace it with:",[146,614,616],{"className":148,"code":615,"language":150,"meta":151,"style":151},"    if button_b.was_pressed():\n        direction = compass.heading()\n\n        if direction > 315 or direction \u003C 45:\n            display.show(\"N\")\n        elif direction \u003C 135:\n            display.show(\"E\")\n        elif direction \u003C 225:\n            display.show(\"S\")\n        else:\n            display.show(\"W\")\n\n        sleep(500)\n",[153,617,618,622,627,631,636,641,646,652,658,664,669,675,680],{"__ignoreMap":151},[156,619,620],{"class":158,"line":159},[156,621,496],{},[156,623,624],{"class":158,"line":206},[156,625,626],{},"        direction = compass.heading()\n",[156,628,629],{"class":158,"line":213},[156,630,210],{"emptyLinePlaceholder":209},[156,632,633],{"class":158,"line":294},[156,634,635],{},"        if direction > 315 or direction \u003C 45:\n",[156,637,638],{"class":158,"line":402},[156,639,640],{},"            display.show(\"N\")\n",[156,642,643],{"class":158,"line":408},[156,644,645],{},"        elif direction \u003C 135:\n",[156,647,649],{"class":158,"line":648},7,[156,650,651],{},"            display.show(\"E\")\n",[156,653,655],{"class":158,"line":654},8,[156,656,657],{},"        elif direction \u003C 225:\n",[156,659,661],{"class":158,"line":660},9,[156,662,663],{},"            display.show(\"S\")\n",[156,665,667],{"class":158,"line":666},10,[156,668,399],{},[156,670,672],{"class":158,"line":671},11,[156,673,674],{},"            display.show(\"W\")\n",[156,676,678],{"class":158,"line":677},12,[156,679,210],{"emptyLinePlaceholder":209},[156,681,683],{"class":158,"line":682},13,[156,684,411],{},[17,686,687],{},"Your finished compass code should look like this:",[17,689,690],{},[168,691],{"alt":692,"src":693},"The finished Python compass code showing N, E, S or W","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FS5_CompassSensingTricky.webp",[695,696,698],"h3",{"id":697},"how-the-code-works","How the code works",[17,700,701,702,705,706,709],{},"This line creates a ",[24,703,704],{"slug":704},"variable"," called ",[153,707,708],{},"direction",":",[146,711,713],{"className":148,"code":712,"language":150,"meta":151,"style":151},"direction = compass.heading()\n",[153,714,715],{"__ignoreMap":151},[156,716,717],{"class":158,"line":159},[156,718,712],{},[17,720,721],{},"It stores the current compass heading as a number.",[17,723,724],{},"The code then checks that number:",[33,726,727,738,745,751],{},[36,728,729,730,733,734,737],{},"More than ",[153,731,732],{},"315"," or less than ",[153,735,736],{},"45"," means north",[36,739,740,741,744],{},"Less than ",[153,742,743],{},"135"," means east",[36,746,740,747,750],{},[153,748,749],{},"225"," means south",[36,752,753],{},"Anything else means west",[65,755,757,762],{"color":174,"icon":756},"🍕",[17,758,759],{},[72,760,761],{},"How your code decides",[17,763,764],{},"Imagine the compass is a pizza cut into four slices. The code checks which slice the compass number has landed in, then shows the letter for that direction.",[13,766,768,771,913,916,950],{"title":767},"Check the finished code",[17,769,770],{},"Your complete Python program should now look like this:",[146,772,774],{"className":148,"code":773,"language":150,"meta":151,"style":151},"from microbit import *\n\ncompass.calibrate()\n\nwhile True:\n    if accelerometer.was_gesture(\"shake\"):\n        display.scroll(temperature())\n        sleep(2000)\n        display.clear()\n\n    if button_a.was_pressed():\n        if display.read_light_level() \u003C 100:\n            display.show(Image.HAPPY)\n        else:\n            display.clear()\n        sleep(500)\n\n    if button_b.was_pressed():\n        direction = compass.heading()\n\n        if direction > 315 or direction \u003C 45:\n            display.show(\"N\")\n        elif direction \u003C 135:\n            display.show(\"E\")\n        elif direction \u003C 225:\n            display.show(\"S\")\n        else:\n            display.show(\"W\")\n\n        sleep(500)\n",[153,775,776,780,784,788,792,796,800,804,808,812,816,820,824,828,833,838,843,848,853,858,863,868,873,878,883,888,893,898,903,908],{"__ignoreMap":151},[156,777,778],{"class":158,"line":159},[156,779,149],{},[156,781,782],{"class":158,"line":206},[156,783,210],{"emptyLinePlaceholder":209},[156,785,786],{"class":158,"line":213},[156,787,203],{},[156,789,790],{"class":158,"line":294},[156,791,210],{"emptyLinePlaceholder":209},[156,793,794],{"class":158,"line":402},[156,795,216],{},[156,797,798],{"class":158,"line":408},[156,799,281],{},[156,801,802],{"class":158,"line":648},[156,803,286],{},[156,805,806],{"class":158,"line":654},[156,807,291],{},[156,809,810],{"class":158,"line":660},[156,811,297],{},[156,813,814],{"class":158,"line":666},[156,815,210],{"emptyLinePlaceholder":209},[156,817,818],{"class":158,"line":671},[156,819,384],{},[156,821,822],{"class":158,"line":677},[156,823,389],{},[156,825,826],{"class":158,"line":682},[156,827,394],{},[156,829,831],{"class":158,"line":830},14,[156,832,399],{},[156,834,836],{"class":158,"line":835},15,[156,837,405],{},[156,839,841],{"class":158,"line":840},16,[156,842,411],{},[156,844,846],{"class":158,"line":845},17,[156,847,210],{"emptyLinePlaceholder":209},[156,849,851],{"class":158,"line":850},18,[156,852,496],{},[156,854,856],{"class":158,"line":855},19,[156,857,626],{},[156,859,861],{"class":158,"line":860},20,[156,862,210],{"emptyLinePlaceholder":209},[156,864,866],{"class":158,"line":865},21,[156,867,635],{},[156,869,871],{"class":158,"line":870},22,[156,872,640],{},[156,874,876],{"class":158,"line":875},23,[156,877,645],{},[156,879,881],{"class":158,"line":880},24,[156,882,651],{},[156,884,886],{"class":158,"line":885},25,[156,887,657],{},[156,889,891],{"class":158,"line":890},26,[156,892,663],{},[156,894,896],{"class":158,"line":895},27,[156,897,399],{},[156,899,901],{"class":158,"line":900},28,[156,902,674],{},[156,904,906],{"class":158,"line":905},29,[156,907,210],{"emptyLinePlaceholder":209},[156,909,911],{"class":158,"line":910},30,[156,912,411],{},[17,914,915],{},"Before you run it, check:",[33,917,918,934,937,944,947],{},[36,919,920,921,923,924,923,927,520,930,933],{},"Every ",[153,922,367],{},", ",[153,925,926],{},"elif",[153,928,929],{},"else",[153,931,932],{},"while"," line ends with a colon.",[36,935,936],{},"Each section has the correct indentation.",[36,938,939,940,943],{},"Words such as ",[153,941,942],{},"Image.HAPPY"," use the correct capital letters.",[36,945,946],{},"Every opening bracket has a matching closing bracket.",[36,948,949],{},"The words inside quotation marks are spelt correctly.",[65,951,953],{"color":174,"icon":952},"🐛",[17,954,955],{},"Python is very precise. A missing colon, bracket or space can stop the program from running, so check one line at a time.",[13,957,959,962,995,1001],{"title":958},"Download your code",[17,960,961],{},"Your environment detector is ready to transfer to the micro:bit.",[118,963,964,967,977,980,987,990],{},[36,965,966],{},"Connect the micro:bit to your computer using the micro USB cable.",[36,968,969,970,973,974,63],{},"Select the ",[72,971,972],{},"three dots"," next to ",[72,975,976],{},"Send to micro:bit",[36,978,979],{},"Follow the instructions on the screen.",[36,981,982,983,986],{},"Select ",[72,984,985],{},"Connect"," when asked.",[36,988,989],{},"Choose your micro:bit from the list.",[36,991,982,992,994],{},[72,993,976],{}," to download the code.",[17,996,997],{},[168,998],{"alt":999,"src":1000},"Sending the Python code to the micro:bit","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FDownloadingCode.webp",[65,1002,1004],{"color":174,"icon":1003},"🔌",[17,1005,1006],{},"If the editor cannot find the micro:bit, try another USB cable. Some cables can only charge devices and cannot transfer code.",[13,1008,1010,1013,1017,1020,1026,1031,1045,1049,1065,1068,1082,1086,1106],{"title":1009},"Test your environment detector",[17,1011,1012],{},"You can test the project using the simulator or a real micro:bit.",[695,1014,1016],{"id":1015},"test-the-simulator","Test the simulator",[17,1018,1019],{},"The Python editor has a built-in micro:bit simulator.",[17,1021,1022],{},[168,1023],{"alt":1024,"src":1025},"Testing the Environment Detective project in the Python simulator","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FSimDemo.gif",[1027,1028,1030],"h4",{"id":1029},"temperature","Temperature",[118,1032,1033,1036,1039,1042],{},[36,1034,1035],{},"Find the shake control underneath the simulator.",[36,1037,1038],{},"Select the play button next to it.",[36,1040,1041],{},"Watch the temperature appear on the LED matrix.",[36,1043,1044],{},"Move the temperature slider and test it again.",[1027,1046,1048],{"id":1047},"light","Light",[118,1050,1051,1054,1057,1060],{},[36,1052,1053],{},"Find the sun symbol underneath the simulator.",[36,1055,1056],{},"Move its slider to change the light level.",[36,1058,1059],{},"Press button A on the simulator.",[36,1061,1062,1063,63],{},"A happy face should appear when the light level is below ",[153,1064,434],{},[1027,1066,1067],{"id":55},"Compass",[118,1069,1070,1073,1076,1079],{},[36,1071,1072],{},"Find the compass control underneath the simulator.",[36,1074,1075],{},"Move the slider to change the direction.",[36,1077,1078],{},"Press button B.",[36,1080,1081],{},"Watch the direction letter appear on the LED matrix.",[695,1083,1085],{"id":1084},"test-a-real-microbit","Test a real micro:bit",[33,1087,1088,1094,1100],{},[36,1089,1090,1093],{},[72,1091,1092],{},"Temperature:"," Shake the micro:bit to display the temperature.",[36,1095,1096,1099],{},[72,1097,1098],{},"Light:"," Cover the micro:bit with your hand and press button A.",[36,1101,1102,1105],{},[72,1103,1104],{},"Compass:"," Turn in a different direction and press button B.",[65,1107,1108,1113,1116],{"color":174,"icon":175},[17,1109,1110],{},[72,1111,1112],{},"Compass calibration",[17,1114,1115],{},"When the micro:bit starts, it may ask you to tilt it around until every LED is switched on.",[17,1117,1118],{},"This is called calibrating. It helps the compass work out which direction is north.",[13,1120,1122],{"title":1121},"Try it yourself",[1123,1124,1125,1130,1133,1146,1149,1164,1167,1182,1185],"try-it",{},[17,1126,1127],{},[72,1128,1129],{},"Challenge: Build an environment warning system",[17,1131,1132],{},"Can you make the micro:bit warn you when the room gets too cold?",[17,1134,1135,1136,1138,1139,1142,1143,63],{},"Inside the temperature section, add another ",[153,1137,367],{}," statement that checks whether ",[153,1140,1141],{},"temperature()"," is below a number you choose, such as ",[153,1144,1145],{},"15",[17,1147,1148],{},"You could start with:",[146,1150,1152],{"className":148,"code":1151,"language":150,"meta":151,"style":151},"        if temperature() \u003C 15:\n            display.show(Image.SAD)\n",[153,1153,1154,1159],{"__ignoreMap":151},[156,1155,1156],{"class":158,"line":159},[156,1157,1158],{},"        if temperature() \u003C 15:\n",[156,1160,1161],{"class":158,"line":206},[156,1162,1163],{},"            display.show(Image.SAD)\n",[17,1165,1166],{},"You could make the micro:bit show:",[33,1168,1169,1174,1179],{},[36,1170,1171],{},[153,1172,1173],{},"Image.SAD",[36,1175,1176],{},[153,1177,1178],{},"Image.SKULL",[36,1180,1181],{},"A picture of your own",[17,1183,1184],{},"Can you create another warning for the light sensor?",[17,1186,1187],{},"Try changing the button A code so the micro:bit shows a warning picture when the room gets too dark.",[13,1189,1191,1294],{"title":1190},"Stuck? Quick fixes",[525,1192,1193,1203],{},[528,1194,1195],{},[531,1196,1197,1200],{},[534,1198,1199],{},"Problem",[534,1201,1202],{},"Try this",[542,1204,1205,1220,1228,1243,1251,1270,1278,1286],{},[531,1206,1207,1210],{},[547,1208,1209],{},"Nothing happens when I shake the micro:bit",[547,1211,1212,1213,1215,1216,1219],{},"Check that the line begins with ",[153,1214,367],{}," and ends with a colon: ",[153,1217,1218],{},"if accelerometer.was_gesture(\"shake\"):",". Make sure the display instructions are indented underneath it.",[531,1221,1222,1225],{},[547,1223,1224],{},"The temperature looks too warm",[547,1226,1227],{},"This is normal. The sensor is on the micro:bit itself, so it can warm up after the board has been switched on or held in your hand.",[531,1229,1230,1233],{},[547,1231,1232],{},"The happy face does not appear",[547,1234,1235,1236,1238,1239,1242],{},"Cover the micro:bit with your hand. Check that your comparison says ",[153,1237,476],{}," and that ",[153,1240,1241],{},"display.show(Image.HAPPY)"," is indented underneath it.",[531,1244,1245,1248],{},[547,1246,1247],{},"Button B shows the wrong direction",[547,1249,1250],{},"Complete the compass calibration by tilting the micro:bit until every LED has lit up.",[531,1252,1253,1256],{},[547,1254,1255],{},"The compass always shows W",[547,1257,1258,1259,520,1261,1263,1264,1266,1267,1269],{},"Check the numbers in your comparisons: ",[153,1260,732],{},[153,1262,736],{}," for north, ",[153,1265,743],{}," for east and ",[153,1268,749],{}," for south.",[531,1271,1272,1275],{},[547,1273,1274],{},"I see an error message",[547,1276,1277],{},"Check your spelling, brackets, quotation marks, colons and indentation. Python needs these to be exact.",[531,1279,1280,1283],{},[547,1281,1282],{},"The code keeps showing a number before the letter",[547,1284,1285],{},"Check that you removed the first, easier button B section before adding the letter version.",[531,1287,1288,1291],{},[547,1289,1290],{},"My code will not download",[547,1292,1293],{},"Try another USB cable or USB socket. Check that the micro:bit is connected to the Python editor.",[65,1295,1296],{"color":67,"icon":952},[17,1297,1298],{},"Don’t worry if it doesn’t work first time. That’s how coding works! Check one line at a time and compare it with the pictures.",[1300,1301,1302],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":151,"searchDepth":206,"depth":206,"links":1304},[],false,"45 mins","md","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002FEnvironmentDetectiveCover.webp",[27,1310,1311,1312],"micro:bit Python editor","Micro USB cable","Battery pack (optional)","Beginner",{},"\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective","\u002Flearn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002Fenvironment-detective.pdf","microbit",{"title":5,"description":151},"learn\u002Fmicrobit\u002Fpython\u002Fenvironment-detective\u002Findex","ys6ojBuDsjOQsXzAWLqsVrDLz5vd7jE6i483w_Lqwbg",{"id":4,"title":5,"body":1322,"description":151,"draft":1305,"duration":1306,"extension":1307,"image":1308,"kit":2237,"language":150,"level":1313,"meta":2238,"navigation":209,"path":1315,"pdf":1316,"platform":1317,"seo":2239,"stem":1319,"youtube":151,"__hash__":1320},{"type":7,"value":1323,"toc":2235},[1324,2233],[10,1325,1326,1376,1380,1384,1425,1479,1547,1627,1703,1835,1991,2025,2101,2151],{},[13,1327,1328,1330,1334,1336,1350,1354,1374],{"title":15},[17,1329,19],{},[17,1331,22,1332,28],{},[24,1333,27],{"slug":26},[17,1335,31],{},[33,1337,1338,1342,1346],{},[36,1339,38,1340],{},[24,1341,42],{"slug":41},[36,1343,45,1344],{},[24,1345,49],{"slug":48},[36,1347,52,1348],{},[24,1349,55],{"slug":55},[17,1351,58,1352,63],{},[24,1353,62],{"slug":61},[65,1355,1356,1360],{"color":67,"icon":68},[17,1357,1358],{},[72,1359,74],{},[33,1361,1362,1364,1366,1368,1370,1372],{},[36,1363,79],{},[36,1365,82],{},[36,1367,85],{},[36,1369,88],{},[36,1371,91],{},[36,1373,94],{},[17,1375,97],{},[13,1377,1378],{"title":100},[102,1379],{},[13,1381,1382],{"title":106},[108,1383],{"terms":110},[13,1385,1386,1388,1405,1413,1415,1419],{"title":113},[17,1387,116],{},[118,1389,1390,1392,1397,1399,1401,1403],{},[36,1391,122],{},[36,1393,125,1394,63],{},[127,1395,132],{"href":129,"rel":1396},[131],[36,1398,135],{},[36,1400,138],{},[36,1402,141],{},[36,1404,144],{},[146,1406,1407],{"className":148,"code":149,"language":150,"meta":151,"style":151},[153,1408,1409],{"__ignoreMap":151},[156,1410,1411],{"class":158,"line":159},[156,1412,149],{},[17,1414,164],{},[17,1416,1417],{},[168,1418],{"alt":170,"src":171},[65,1420,1421],{"color":174,"icon":175},[17,1422,1423,181],{},[153,1424,180],{},[13,1426,1427,1429,1433,1449,1455,1459,1463,1469],{"title":184},[17,1428,187],{},[17,1430,190,1431,193],{},[153,1432,180],{},[146,1434,1435],{"className":148,"code":196,"language":150,"meta":151,"style":151},[153,1436,1437,1441,1445],{"__ignoreMap":151},[156,1438,1439],{"class":158,"line":159},[156,1440,203],{},[156,1442,1443],{"class":158,"line":206},[156,1444,210],{"emptyLinePlaceholder":209},[156,1446,1447],{"class":158,"line":213},[156,1448,216],{},[17,1450,219,1451,223,1453,63],{},[72,1452,222],{},[153,1454,226],{},[17,1456,229,1457,63],{},[72,1458,232],{},[17,1460,1461],{},[168,1462],{"alt":237,"src":238},[65,1464,1465],{"color":174,"icon":241},[17,1466,1467,246],{},[153,1468,226],{},[65,1470,1471,1475],{"color":174,"icon":249},[17,1472,1473],{},[72,1474,254],{},[17,1476,257,1477,260],{},[153,1478,226],{},[13,1480,1481,1483,1487,1507,1509,1511,1515,1517,1535,1539],{"title":263},[17,1482,266],{},[17,1484,269,1485,193],{},[153,1486,226],{},[146,1488,1489],{"className":148,"code":274,"language":150,"meta":151,"style":151},[153,1490,1491,1495,1499,1503],{"__ignoreMap":151},[156,1492,1493],{"class":158,"line":159},[156,1494,281],{},[156,1496,1497],{"class":158,"line":206},[156,1498,286],{},[156,1500,1501],{"class":158,"line":213},[156,1502,291],{},[156,1504,1505],{"class":158,"line":294},[156,1506,297],{},[17,1508,300],{},[17,1510,303],{},[17,1512,1513],{},[168,1514],{"alt":308,"src":309},[17,1516,312],{},[33,1518,1519,1523,1527,1531],{},[36,1520,1521,320],{},[153,1522,319],{},[36,1524,1525,326],{},[153,1526,325],{},[36,1528,1529,332],{},[153,1530,331],{},[36,1532,1533,338],{},[153,1534,337],{},[65,1536,1537],{"color":67,"icon":341},[17,1538,344],{},[65,1540,1541],{"color":174,"icon":175},[17,1542,349,1543,353,1545,332],{},[153,1544,352],{},[153,1546,331],{},[13,1548,1549,1551,1557,1559,1587,1589,1593,1595,1607,1613,1617],{"title":358},[17,1550,361],{},[17,1552,364,1553,368,1555,371],{},[153,1554,367],{},[153,1556,367],{},[17,1558,374],{},[146,1560,1561],{"className":148,"code":377,"language":150,"meta":151,"style":151},[153,1562,1563,1567,1571,1575,1579,1583],{"__ignoreMap":151},[156,1564,1565],{"class":158,"line":159},[156,1566,384],{},[156,1568,1569],{"class":158,"line":206},[156,1570,389],{},[156,1572,1573],{"class":158,"line":213},[156,1574,394],{},[156,1576,1577],{"class":158,"line":294},[156,1578,399],{},[156,1580,1581],{"class":158,"line":402},[156,1582,405],{},[156,1584,1585],{"class":158,"line":408},[156,1586,411],{},[17,1588,414],{},[17,1590,1591],{},[168,1592],{"alt":419,"src":420},[17,1594,423],{},[33,1596,1597,1599,1603,1605],{},[36,1598,428],{},[36,1600,431,1601,435],{},[153,1602,434],{},[36,1604,438],{},[36,1606,441],{},[17,1608,444,1609,449,1611,454],{},[24,1610,448],{"slug":447},[24,1612,453],{"slug":452},[65,1614,1615],{"color":174,"icon":457},[17,1616,460],{},[65,1618,1619],{"color":174,"icon":175},[17,1620,465,1621,469,1623,473,1625,477],{},[153,1622,468],{},[72,1624,472],{},[153,1626,476],{},[13,1628,1629,1631,1633,1649,1651,1655,1661,1697,1701],{"title":480},[17,1630,483],{},[17,1632,486],{},[146,1634,1635],{"className":148,"code":489,"language":150,"meta":151,"style":151},[153,1636,1637,1641,1645],{"__ignoreMap":151},[156,1638,1639],{"class":158,"line":159},[156,1640,496],{},[156,1642,1643],{"class":158,"line":206},[156,1644,501],{},[156,1646,1647],{"class":158,"line":213},[156,1648,411],{},[17,1650,303],{},[17,1652,1653],{},[168,1654],{"alt":512,"src":513},[17,1656,516,1657,520,1659,63],{},[153,1658,519],{},[153,1660,523],{},[525,1662,1663,1671],{},[528,1664,1665],{},[531,1666,1667,1669],{},[534,1668,536],{},[534,1670,540],{"align":539},[542,1672,1673,1679,1685,1691],{},[531,1674,1675,1677],{},[547,1676,549],{},[547,1678,519],{"align":539},[531,1680,1681,1683],{},[547,1682,556],{},[547,1684,559],{"align":539},[531,1686,1687,1689],{},[547,1688,564],{},[547,1690,567],{"align":539},[531,1692,1693,1695],{},[547,1694,572],{},[547,1696,575],{"align":539},[65,1698,1699],{"color":174,"icon":578},[17,1700,581],{},[17,1702,584],{},[13,1704,1705,1707,1709,1725,1727,1783,1785,1789,1791,1797,1805,1807,1809,1827],{"title":587},[17,1706,590],{},[17,1708,593],{},[146,1710,1711],{"className":148,"code":489,"language":150,"meta":151,"style":151},[153,1712,1713,1717,1721],{"__ignoreMap":151},[156,1714,1715],{"class":158,"line":159},[156,1716,496],{},[156,1718,1719],{"class":158,"line":206},[156,1720,501],{},[156,1722,1723],{"class":158,"line":213},[156,1724,411],{},[17,1726,612],{},[146,1728,1729],{"className":148,"code":615,"language":150,"meta":151,"style":151},[153,1730,1731,1735,1739,1743,1747,1751,1755,1759,1763,1767,1771,1775,1779],{"__ignoreMap":151},[156,1732,1733],{"class":158,"line":159},[156,1734,496],{},[156,1736,1737],{"class":158,"line":206},[156,1738,626],{},[156,1740,1741],{"class":158,"line":213},[156,1742,210],{"emptyLinePlaceholder":209},[156,1744,1745],{"class":158,"line":294},[156,1746,635],{},[156,1748,1749],{"class":158,"line":402},[156,1750,640],{},[156,1752,1753],{"class":158,"line":408},[156,1754,645],{},[156,1756,1757],{"class":158,"line":648},[156,1758,651],{},[156,1760,1761],{"class":158,"line":654},[156,1762,657],{},[156,1764,1765],{"class":158,"line":660},[156,1766,663],{},[156,1768,1769],{"class":158,"line":666},[156,1770,399],{},[156,1772,1773],{"class":158,"line":671},[156,1774,674],{},[156,1776,1777],{"class":158,"line":677},[156,1778,210],{"emptyLinePlaceholder":209},[156,1780,1781],{"class":158,"line":682},[156,1782,411],{},[17,1784,687],{},[17,1786,1787],{},[168,1788],{"alt":692,"src":693},[695,1790,698],{"id":697},[17,1792,701,1793,705,1795,709],{},[24,1794,704],{"slug":704},[153,1796,708],{},[146,1798,1799],{"className":148,"code":712,"language":150,"meta":151,"style":151},[153,1800,1801],{"__ignoreMap":151},[156,1802,1803],{"class":158,"line":159},[156,1804,712],{},[17,1806,721],{},[17,1808,724],{},[33,1810,1811,1817,1821,1825],{},[36,1812,729,1813,733,1815,737],{},[153,1814,732],{},[153,1816,736],{},[36,1818,740,1819,744],{},[153,1820,743],{},[36,1822,740,1823,750],{},[153,1824,749],{},[36,1826,753],{},[65,1828,1829,1833],{"color":174,"icon":756},[17,1830,1831],{},[72,1832,761],{},[17,1834,764],{},[13,1836,1837,1839,1963,1965,1987],{"title":767},[17,1838,770],{},[146,1840,1841],{"className":148,"code":773,"language":150,"meta":151,"style":151},[153,1842,1843,1847,1851,1855,1859,1863,1867,1871,1875,1879,1883,1887,1891,1895,1899,1903,1907,1911,1915,1919,1923,1927,1931,1935,1939,1943,1947,1951,1955,1959],{"__ignoreMap":151},[156,1844,1845],{"class":158,"line":159},[156,1846,149],{},[156,1848,1849],{"class":158,"line":206},[156,1850,210],{"emptyLinePlaceholder":209},[156,1852,1853],{"class":158,"line":213},[156,1854,203],{},[156,1856,1857],{"class":158,"line":294},[156,1858,210],{"emptyLinePlaceholder":209},[156,1860,1861],{"class":158,"line":402},[156,1862,216],{},[156,1864,1865],{"class":158,"line":408},[156,1866,281],{},[156,1868,1869],{"class":158,"line":648},[156,1870,286],{},[156,1872,1873],{"class":158,"line":654},[156,1874,291],{},[156,1876,1877],{"class":158,"line":660},[156,1878,297],{},[156,1880,1881],{"class":158,"line":666},[156,1882,210],{"emptyLinePlaceholder":209},[156,1884,1885],{"class":158,"line":671},[156,1886,384],{},[156,1888,1889],{"class":158,"line":677},[156,1890,389],{},[156,1892,1893],{"class":158,"line":682},[156,1894,394],{},[156,1896,1897],{"class":158,"line":830},[156,1898,399],{},[156,1900,1901],{"class":158,"line":835},[156,1902,405],{},[156,1904,1905],{"class":158,"line":840},[156,1906,411],{},[156,1908,1909],{"class":158,"line":845},[156,1910,210],{"emptyLinePlaceholder":209},[156,1912,1913],{"class":158,"line":850},[156,1914,496],{},[156,1916,1917],{"class":158,"line":855},[156,1918,626],{},[156,1920,1921],{"class":158,"line":860},[156,1922,210],{"emptyLinePlaceholder":209},[156,1924,1925],{"class":158,"line":865},[156,1926,635],{},[156,1928,1929],{"class":158,"line":870},[156,1930,640],{},[156,1932,1933],{"class":158,"line":875},[156,1934,645],{},[156,1936,1937],{"class":158,"line":880},[156,1938,651],{},[156,1940,1941],{"class":158,"line":885},[156,1942,657],{},[156,1944,1945],{"class":158,"line":890},[156,1946,663],{},[156,1948,1949],{"class":158,"line":895},[156,1950,399],{},[156,1952,1953],{"class":158,"line":900},[156,1954,674],{},[156,1956,1957],{"class":158,"line":905},[156,1958,210],{"emptyLinePlaceholder":209},[156,1960,1961],{"class":158,"line":910},[156,1962,411],{},[17,1964,915],{},[33,1966,1967,1977,1979,1983,1985],{},[36,1968,920,1969,923,1971,923,1973,520,1975,933],{},[153,1970,367],{},[153,1972,926],{},[153,1974,929],{},[153,1976,932],{},[36,1978,936],{},[36,1980,939,1981,943],{},[153,1982,942],{},[36,1984,946],{},[36,1986,949],{},[65,1988,1989],{"color":174,"icon":952},[17,1990,955],{},[13,1992,1993,1995,2017,2021],{"title":958},[17,1994,961],{},[118,1996,1997,1999,2005,2007,2011,2013],{},[36,1998,966],{},[36,2000,969,2001,973,2003,63],{},[72,2002,972],{},[72,2004,976],{},[36,2006,979],{},[36,2008,982,2009,986],{},[72,2010,985],{},[36,2012,989],{},[36,2014,982,2015,994],{},[72,2016,976],{},[17,2018,2019],{},[168,2020],{"alt":999,"src":1000},[65,2022,2023],{"color":174,"icon":1003},[17,2024,1006],{},[13,2026,2027,2029,2031,2033,2037,2039,2049,2051,2063,2065,2075,2077,2091],{"title":1009},[17,2028,1012],{},[695,2030,1016],{"id":1015},[17,2032,1019],{},[17,2034,2035],{},[168,2036],{"alt":1024,"src":1025},[1027,2038,1030],{"id":1029},[118,2040,2041,2043,2045,2047],{},[36,2042,1035],{},[36,2044,1038],{},[36,2046,1041],{},[36,2048,1044],{},[1027,2050,1048],{"id":1047},[118,2052,2053,2055,2057,2059],{},[36,2054,1053],{},[36,2056,1056],{},[36,2058,1059],{},[36,2060,1062,2061,63],{},[153,2062,434],{},[1027,2064,1067],{"id":55},[118,2066,2067,2069,2071,2073],{},[36,2068,1072],{},[36,2070,1075],{},[36,2072,1078],{},[36,2074,1081],{},[695,2076,1085],{"id":1084},[33,2078,2079,2083,2087],{},[36,2080,2081,1093],{},[72,2082,1092],{},[36,2084,2085,1099],{},[72,2086,1098],{},[36,2088,2089,1105],{},[72,2090,1104],{},[65,2092,2093,2097,2099],{"color":174,"icon":175},[17,2094,2095],{},[72,2096,1112],{},[17,2098,1115],{},[17,2100,1118],{},[13,2102,2103],{"title":1121},[1123,2104,2105,2109,2111,2119,2121,2133,2135,2147,2149],{},[17,2106,2107],{},[72,2108,1129],{},[17,2110,1132],{},[17,2112,1135,2113,1138,2115,1142,2117,63],{},[153,2114,367],{},[153,2116,1141],{},[153,2118,1145],{},[17,2120,1148],{},[146,2122,2123],{"className":148,"code":1151,"language":150,"meta":151,"style":151},[153,2124,2125,2129],{"__ignoreMap":151},[156,2126,2127],{"class":158,"line":159},[156,2128,1158],{},[156,2130,2131],{"class":158,"line":206},[156,2132,1163],{},[17,2134,1166],{},[33,2136,2137,2141,2145],{},[36,2138,2139],{},[153,2140,1173],{},[36,2142,2143],{},[153,2144,1178],{},[36,2146,1181],{},[17,2148,1184],{},[17,2150,1187],{},[13,2152,2153,2229],{"title":1190},[525,2154,2155,2163],{},[528,2156,2157],{},[531,2158,2159,2161],{},[534,2160,1199],{},[534,2162,1202],{},[542,2164,2165,2175,2181,2191,2197,2211,2217,2223],{},[531,2166,2167,2169],{},[547,2168,1209],{},[547,2170,1212,2171,1215,2173,1219],{},[153,2172,367],{},[153,2174,1218],{},[531,2176,2177,2179],{},[547,2178,1224],{},[547,2180,1227],{},[531,2182,2183,2185],{},[547,2184,1232],{},[547,2186,1235,2187,1238,2189,1242],{},[153,2188,476],{},[153,2190,1241],{},[531,2192,2193,2195],{},[547,2194,1247],{},[547,2196,1250],{},[531,2198,2199,2201],{},[547,2200,1255],{},[547,2202,1258,2203,520,2205,1263,2207,1266,2209,1269],{},[153,2204,732],{},[153,2206,736],{},[153,2208,743],{},[153,2210,749],{},[531,2212,2213,2215],{},[547,2214,1274],{},[547,2216,1277],{},[531,2218,2219,2221],{},[547,2220,1282],{},[547,2222,1285],{},[531,2224,2225,2227],{},[547,2226,1290],{},[547,2228,1293],{},[65,2230,2231],{"color":67,"icon":952},[17,2232,1298],{},[1300,2234,1302],{},{"title":151,"searchDepth":206,"depth":206,"links":2236},[],[27,1310,1311,1312],{},{"title":5,"description":151},{"id":4,"title":5,"body":2241,"description":151,"draft":1305,"duration":1306,"extension":1307,"image":1308,"kit":3156,"language":150,"level":1313,"meta":3157,"navigation":209,"path":1315,"pdf":1316,"platform":1317,"seo":3158,"stem":1319,"youtube":151,"__hash__":1320},{"type":7,"value":2242,"toc":3154},[2243,3152],[10,2244,2245,2295,2299,2303,2344,2398,2466,2546,2622,2754,2910,2944,3020,3070],{},[13,2246,2247,2249,2253,2255,2269,2273,2293],{"title":15},[17,2248,19],{},[17,2250,22,2251,28],{},[24,2252,27],{"slug":26},[17,2254,31],{},[33,2256,2257,2261,2265],{},[36,2258,38,2259],{},[24,2260,42],{"slug":41},[36,2262,45,2263],{},[24,2264,49],{"slug":48},[36,2266,52,2267],{},[24,2268,55],{"slug":55},[17,2270,58,2271,63],{},[24,2272,62],{"slug":61},[65,2274,2275,2279],{"color":67,"icon":68},[17,2276,2277],{},[72,2278,74],{},[33,2280,2281,2283,2285,2287,2289,2291],{},[36,2282,79],{},[36,2284,82],{},[36,2286,85],{},[36,2288,88],{},[36,2290,91],{},[36,2292,94],{},[17,2294,97],{},[13,2296,2297],{"title":100},[102,2298],{},[13,2300,2301],{"title":106},[108,2302],{"terms":110},[13,2304,2305,2307,2324,2332,2334,2338],{"title":113},[17,2306,116],{},[118,2308,2309,2311,2316,2318,2320,2322],{},[36,2310,122],{},[36,2312,125,2313,63],{},[127,2314,132],{"href":129,"rel":2315},[131],[36,2317,135],{},[36,2319,138],{},[36,2321,141],{},[36,2323,144],{},[146,2325,2326],{"className":148,"code":149,"language":150,"meta":151,"style":151},[153,2327,2328],{"__ignoreMap":151},[156,2329,2330],{"class":158,"line":159},[156,2331,149],{},[17,2333,164],{},[17,2335,2336],{},[168,2337],{"alt":170,"src":171},[65,2339,2340],{"color":174,"icon":175},[17,2341,2342,181],{},[153,2343,180],{},[13,2345,2346,2348,2352,2368,2374,2378,2382,2388],{"title":184},[17,2347,187],{},[17,2349,190,2350,193],{},[153,2351,180],{},[146,2353,2354],{"className":148,"code":196,"language":150,"meta":151,"style":151},[153,2355,2356,2360,2364],{"__ignoreMap":151},[156,2357,2358],{"class":158,"line":159},[156,2359,203],{},[156,2361,2362],{"class":158,"line":206},[156,2363,210],{"emptyLinePlaceholder":209},[156,2365,2366],{"class":158,"line":213},[156,2367,216],{},[17,2369,219,2370,223,2372,63],{},[72,2371,222],{},[153,2373,226],{},[17,2375,229,2376,63],{},[72,2377,232],{},[17,2379,2380],{},[168,2381],{"alt":237,"src":238},[65,2383,2384],{"color":174,"icon":241},[17,2385,2386,246],{},[153,2387,226],{},[65,2389,2390,2394],{"color":174,"icon":249},[17,2391,2392],{},[72,2393,254],{},[17,2395,257,2396,260],{},[153,2397,226],{},[13,2399,2400,2402,2406,2426,2428,2430,2434,2436,2454,2458],{"title":263},[17,2401,266],{},[17,2403,269,2404,193],{},[153,2405,226],{},[146,2407,2408],{"className":148,"code":274,"language":150,"meta":151,"style":151},[153,2409,2410,2414,2418,2422],{"__ignoreMap":151},[156,2411,2412],{"class":158,"line":159},[156,2413,281],{},[156,2415,2416],{"class":158,"line":206},[156,2417,286],{},[156,2419,2420],{"class":158,"line":213},[156,2421,291],{},[156,2423,2424],{"class":158,"line":294},[156,2425,297],{},[17,2427,300],{},[17,2429,303],{},[17,2431,2432],{},[168,2433],{"alt":308,"src":309},[17,2435,312],{},[33,2437,2438,2442,2446,2450],{},[36,2439,2440,320],{},[153,2441,319],{},[36,2443,2444,326],{},[153,2445,325],{},[36,2447,2448,332],{},[153,2449,331],{},[36,2451,2452,338],{},[153,2453,337],{},[65,2455,2456],{"color":67,"icon":341},[17,2457,344],{},[65,2459,2460],{"color":174,"icon":175},[17,2461,349,2462,353,2464,332],{},[153,2463,352],{},[153,2465,331],{},[13,2467,2468,2470,2476,2478,2506,2508,2512,2514,2526,2532,2536],{"title":358},[17,2469,361],{},[17,2471,364,2472,368,2474,371],{},[153,2473,367],{},[153,2475,367],{},[17,2477,374],{},[146,2479,2480],{"className":148,"code":377,"language":150,"meta":151,"style":151},[153,2481,2482,2486,2490,2494,2498,2502],{"__ignoreMap":151},[156,2483,2484],{"class":158,"line":159},[156,2485,384],{},[156,2487,2488],{"class":158,"line":206},[156,2489,389],{},[156,2491,2492],{"class":158,"line":213},[156,2493,394],{},[156,2495,2496],{"class":158,"line":294},[156,2497,399],{},[156,2499,2500],{"class":158,"line":402},[156,2501,405],{},[156,2503,2504],{"class":158,"line":408},[156,2505,411],{},[17,2507,414],{},[17,2509,2510],{},[168,2511],{"alt":419,"src":420},[17,2513,423],{},[33,2515,2516,2518,2522,2524],{},[36,2517,428],{},[36,2519,431,2520,435],{},[153,2521,434],{},[36,2523,438],{},[36,2525,441],{},[17,2527,444,2528,449,2530,454],{},[24,2529,448],{"slug":447},[24,2531,453],{"slug":452},[65,2533,2534],{"color":174,"icon":457},[17,2535,460],{},[65,2537,2538],{"color":174,"icon":175},[17,2539,465,2540,469,2542,473,2544,477],{},[153,2541,468],{},[72,2543,472],{},[153,2545,476],{},[13,2547,2548,2550,2552,2568,2570,2574,2580,2616,2620],{"title":480},[17,2549,483],{},[17,2551,486],{},[146,2553,2554],{"className":148,"code":489,"language":150,"meta":151,"style":151},[153,2555,2556,2560,2564],{"__ignoreMap":151},[156,2557,2558],{"class":158,"line":159},[156,2559,496],{},[156,2561,2562],{"class":158,"line":206},[156,2563,501],{},[156,2565,2566],{"class":158,"line":213},[156,2567,411],{},[17,2569,303],{},[17,2571,2572],{},[168,2573],{"alt":512,"src":513},[17,2575,516,2576,520,2578,63],{},[153,2577,519],{},[153,2579,523],{},[525,2581,2582,2590],{},[528,2583,2584],{},[531,2585,2586,2588],{},[534,2587,536],{},[534,2589,540],{"align":539},[542,2591,2592,2598,2604,2610],{},[531,2593,2594,2596],{},[547,2595,549],{},[547,2597,519],{"align":539},[531,2599,2600,2602],{},[547,2601,556],{},[547,2603,559],{"align":539},[531,2605,2606,2608],{},[547,2607,564],{},[547,2609,567],{"align":539},[531,2611,2612,2614],{},[547,2613,572],{},[547,2615,575],{"align":539},[65,2617,2618],{"color":174,"icon":578},[17,2619,581],{},[17,2621,584],{},[13,2623,2624,2626,2628,2644,2646,2702,2704,2708,2710,2716,2724,2726,2728,2746],{"title":587},[17,2625,590],{},[17,2627,593],{},[146,2629,2630],{"className":148,"code":489,"language":150,"meta":151,"style":151},[153,2631,2632,2636,2640],{"__ignoreMap":151},[156,2633,2634],{"class":158,"line":159},[156,2635,496],{},[156,2637,2638],{"class":158,"line":206},[156,2639,501],{},[156,2641,2642],{"class":158,"line":213},[156,2643,411],{},[17,2645,612],{},[146,2647,2648],{"className":148,"code":615,"language":150,"meta":151,"style":151},[153,2649,2650,2654,2658,2662,2666,2670,2674,2678,2682,2686,2690,2694,2698],{"__ignoreMap":151},[156,2651,2652],{"class":158,"line":159},[156,2653,496],{},[156,2655,2656],{"class":158,"line":206},[156,2657,626],{},[156,2659,2660],{"class":158,"line":213},[156,2661,210],{"emptyLinePlaceholder":209},[156,2663,2664],{"class":158,"line":294},[156,2665,635],{},[156,2667,2668],{"class":158,"line":402},[156,2669,640],{},[156,2671,2672],{"class":158,"line":408},[156,2673,645],{},[156,2675,2676],{"class":158,"line":648},[156,2677,651],{},[156,2679,2680],{"class":158,"line":654},[156,2681,657],{},[156,2683,2684],{"class":158,"line":660},[156,2685,663],{},[156,2687,2688],{"class":158,"line":666},[156,2689,399],{},[156,2691,2692],{"class":158,"line":671},[156,2693,674],{},[156,2695,2696],{"class":158,"line":677},[156,2697,210],{"emptyLinePlaceholder":209},[156,2699,2700],{"class":158,"line":682},[156,2701,411],{},[17,2703,687],{},[17,2705,2706],{},[168,2707],{"alt":692,"src":693},[695,2709,698],{"id":697},[17,2711,701,2712,705,2714,709],{},[24,2713,704],{"slug":704},[153,2715,708],{},[146,2717,2718],{"className":148,"code":712,"language":150,"meta":151,"style":151},[153,2719,2720],{"__ignoreMap":151},[156,2721,2722],{"class":158,"line":159},[156,2723,712],{},[17,2725,721],{},[17,2727,724],{},[33,2729,2730,2736,2740,2744],{},[36,2731,729,2732,733,2734,737],{},[153,2733,732],{},[153,2735,736],{},[36,2737,740,2738,744],{},[153,2739,743],{},[36,2741,740,2742,750],{},[153,2743,749],{},[36,2745,753],{},[65,2747,2748,2752],{"color":174,"icon":756},[17,2749,2750],{},[72,2751,761],{},[17,2753,764],{},[13,2755,2756,2758,2882,2884,2906],{"title":767},[17,2757,770],{},[146,2759,2760],{"className":148,"code":773,"language":150,"meta":151,"style":151},[153,2761,2762,2766,2770,2774,2778,2782,2786,2790,2794,2798,2802,2806,2810,2814,2818,2822,2826,2830,2834,2838,2842,2846,2850,2854,2858,2862,2866,2870,2874,2878],{"__ignoreMap":151},[156,2763,2764],{"class":158,"line":159},[156,2765,149],{},[156,2767,2768],{"class":158,"line":206},[156,2769,210],{"emptyLinePlaceholder":209},[156,2771,2772],{"class":158,"line":213},[156,2773,203],{},[156,2775,2776],{"class":158,"line":294},[156,2777,210],{"emptyLinePlaceholder":209},[156,2779,2780],{"class":158,"line":402},[156,2781,216],{},[156,2783,2784],{"class":158,"line":408},[156,2785,281],{},[156,2787,2788],{"class":158,"line":648},[156,2789,286],{},[156,2791,2792],{"class":158,"line":654},[156,2793,291],{},[156,2795,2796],{"class":158,"line":660},[156,2797,297],{},[156,2799,2800],{"class":158,"line":666},[156,2801,210],{"emptyLinePlaceholder":209},[156,2803,2804],{"class":158,"line":671},[156,2805,384],{},[156,2807,2808],{"class":158,"line":677},[156,2809,389],{},[156,2811,2812],{"class":158,"line":682},[156,2813,394],{},[156,2815,2816],{"class":158,"line":830},[156,2817,399],{},[156,2819,2820],{"class":158,"line":835},[156,2821,405],{},[156,2823,2824],{"class":158,"line":840},[156,2825,411],{},[156,2827,2828],{"class":158,"line":845},[156,2829,210],{"emptyLinePlaceholder":209},[156,2831,2832],{"class":158,"line":850},[156,2833,496],{},[156,2835,2836],{"class":158,"line":855},[156,2837,626],{},[156,2839,2840],{"class":158,"line":860},[156,2841,210],{"emptyLinePlaceholder":209},[156,2843,2844],{"class":158,"line":865},[156,2845,635],{},[156,2847,2848],{"class":158,"line":870},[156,2849,640],{},[156,2851,2852],{"class":158,"line":875},[156,2853,645],{},[156,2855,2856],{"class":158,"line":880},[156,2857,651],{},[156,2859,2860],{"class":158,"line":885},[156,2861,657],{},[156,2863,2864],{"class":158,"line":890},[156,2865,663],{},[156,2867,2868],{"class":158,"line":895},[156,2869,399],{},[156,2871,2872],{"class":158,"line":900},[156,2873,674],{},[156,2875,2876],{"class":158,"line":905},[156,2877,210],{"emptyLinePlaceholder":209},[156,2879,2880],{"class":158,"line":910},[156,2881,411],{},[17,2883,915],{},[33,2885,2886,2896,2898,2902,2904],{},[36,2887,920,2888,923,2890,923,2892,520,2894,933],{},[153,2889,367],{},[153,2891,926],{},[153,2893,929],{},[153,2895,932],{},[36,2897,936],{},[36,2899,939,2900,943],{},[153,2901,942],{},[36,2903,946],{},[36,2905,949],{},[65,2907,2908],{"color":174,"icon":952},[17,2909,955],{},[13,2911,2912,2914,2936,2940],{"title":958},[17,2913,961],{},[118,2915,2916,2918,2924,2926,2930,2932],{},[36,2917,966],{},[36,2919,969,2920,973,2922,63],{},[72,2921,972],{},[72,2923,976],{},[36,2925,979],{},[36,2927,982,2928,986],{},[72,2929,985],{},[36,2931,989],{},[36,2933,982,2934,994],{},[72,2935,976],{},[17,2937,2938],{},[168,2939],{"alt":999,"src":1000},[65,2941,2942],{"color":174,"icon":1003},[17,2943,1006],{},[13,2945,2946,2948,2950,2952,2956,2958,2968,2970,2982,2984,2994,2996,3010],{"title":1009},[17,2947,1012],{},[695,2949,1016],{"id":1015},[17,2951,1019],{},[17,2953,2954],{},[168,2955],{"alt":1024,"src":1025},[1027,2957,1030],{"id":1029},[118,2959,2960,2962,2964,2966],{},[36,2961,1035],{},[36,2963,1038],{},[36,2965,1041],{},[36,2967,1044],{},[1027,2969,1048],{"id":1047},[118,2971,2972,2974,2976,2978],{},[36,2973,1053],{},[36,2975,1056],{},[36,2977,1059],{},[36,2979,1062,2980,63],{},[153,2981,434],{},[1027,2983,1067],{"id":55},[118,2985,2986,2988,2990,2992],{},[36,2987,1072],{},[36,2989,1075],{},[36,2991,1078],{},[36,2993,1081],{},[695,2995,1085],{"id":1084},[33,2997,2998,3002,3006],{},[36,2999,3000,1093],{},[72,3001,1092],{},[36,3003,3004,1099],{},[72,3005,1098],{},[36,3007,3008,1105],{},[72,3009,1104],{},[65,3011,3012,3016,3018],{"color":174,"icon":175},[17,3013,3014],{},[72,3015,1112],{},[17,3017,1115],{},[17,3019,1118],{},[13,3021,3022],{"title":1121},[1123,3023,3024,3028,3030,3038,3040,3052,3054,3066,3068],{},[17,3025,3026],{},[72,3027,1129],{},[17,3029,1132],{},[17,3031,1135,3032,1138,3034,1142,3036,63],{},[153,3033,367],{},[153,3035,1141],{},[153,3037,1145],{},[17,3039,1148],{},[146,3041,3042],{"className":148,"code":1151,"language":150,"meta":151,"style":151},[153,3043,3044,3048],{"__ignoreMap":151},[156,3045,3046],{"class":158,"line":159},[156,3047,1158],{},[156,3049,3050],{"class":158,"line":206},[156,3051,1163],{},[17,3053,1166],{},[33,3055,3056,3060,3064],{},[36,3057,3058],{},[153,3059,1173],{},[36,3061,3062],{},[153,3063,1178],{},[36,3065,1181],{},[17,3067,1184],{},[17,3069,1187],{},[13,3071,3072,3148],{"title":1190},[525,3073,3074,3082],{},[528,3075,3076],{},[531,3077,3078,3080],{},[534,3079,1199],{},[534,3081,1202],{},[542,3083,3084,3094,3100,3110,3116,3130,3136,3142],{},[531,3085,3086,3088],{},[547,3087,1209],{},[547,3089,1212,3090,1215,3092,1219],{},[153,3091,367],{},[153,3093,1218],{},[531,3095,3096,3098],{},[547,3097,1224],{},[547,3099,1227],{},[531,3101,3102,3104],{},[547,3103,1232],{},[547,3105,1235,3106,1238,3108,1242],{},[153,3107,476],{},[153,3109,1241],{},[531,3111,3112,3114],{},[547,3113,1247],{},[547,3115,1250],{},[531,3117,3118,3120],{},[547,3119,1255],{},[547,3121,1258,3122,520,3124,1263,3126,1266,3128,1269],{},[153,3123,732],{},[153,3125,736],{},[153,3127,743],{},[153,3129,749],{},[531,3131,3132,3134],{},[547,3133,1274],{},[547,3135,1277],{},[531,3137,3138,3140],{},[547,3139,1282],{},[547,3141,1285],{},[531,3143,3144,3146],{},[547,3145,1290],{},[547,3147,1293],{},[65,3149,3150],{"color":67,"icon":952},[17,3151,1298],{},[1300,3153,1302],{},{"title":151,"searchDepth":206,"depth":206,"links":3155},[],[27,1310,1311,1312],{},{"title":5,"description":151},[3160,3173,3185,3197,3210,3221,3234,3247,3259,3272,3284,3296,3309,3321,3333,3345,3356,3368,3380,3392,3404,3416,3428,3440,3452,3464,3476,3488,3500,3512,3524],{"id":3161,"category":3162,"definition":3163,"example":3164,"extension":1307,"meta":3165,"stem":3170,"term":3171,"__hash__":3172},"glossary\u002Fglossary\u002Faccelerometer.md","Hardware","An accelerometer is a tiny part inside the micro:bit that senses movement, like tilting, shaking or being turned over. It turns that movement into numbers your code can react to.","A bit like the sensor in a games controller that knows when you tilt it to steer, the accelerometer notices when the micro:bit moves.",{"body":3166},{"type":7,"value":3167,"toc":3168},[],{"title":151,"searchDepth":206,"depth":206,"links":3169},[],"glossary\u002Faccelerometer","Accelerometer","ksJj58OEPP72c3cASeHPlPiw73FfxxUbtIkoEIYW2Rc",{"id":3174,"category":3162,"definition":3175,"example":3176,"extension":1307,"meta":3177,"stem":3182,"term":3183,"__hash__":3184},"glossary\u002Fglossary\u002Fbutton.md","A button is a switch you press to tell your project to do something. The code can check whether it's being pressed or not.","Pressing a doorbell is just like pressing a button, one press sends a signal that makes something happen.",{"body":3178},{"type":7,"value":3179,"toc":3180},[],{"title":151,"searchDepth":206,"depth":206,"links":3181},[],"glossary\u002Fbutton","Button","PgfcNSpG1mpSW_fVJZZMkF4D6eYiQLiyKWeq6_CXsMA",{"id":3186,"category":3162,"definition":3187,"example":3188,"extension":1307,"meta":3189,"stem":3194,"term":3195,"__hash__":3196},"glossary\u002Fglossary\u002Fbuzzer.md","A buzzer is a tiny speaker that makes beeps and tones when you send it electricity. By telling it different numbers, you can make it play notes and tunes.","The beep a microwave makes when your food is ready comes from a buzzer.",{"body":3190},{"type":7,"value":3191,"toc":3192},[],{"title":151,"searchDepth":206,"depth":206,"links":3193},[],"glossary\u002Fbuzzer","Buzzer","L0-h_InzgZ_gB0Iy3IE-ojdFF0cXjdB2AxJY0QU0VpU",{"id":3198,"category":3199,"definition":3200,"example":3201,"extension":1307,"meta":3202,"stem":3207,"term":3208,"__hash__":3209},"glossary\u002Fglossary\u002Fcomparison-operators.md","Logic","A comparison operator checks how two things measure up, for example whether they are equal or one is bigger than the other. It gives back a simple true or false answer.","Asking \"is 6 == 6?\" gives back true, but \"is 6 == 2?\" gives back false, so your code knows whether the two numbers match.",{"body":3203},{"type":7,"value":3204,"toc":3205},[],{"title":151,"searchDepth":206,"depth":206,"links":3206},[],"glossary\u002Fcomparison-operators","Comparison Operators","PPG3NDp3Xsx9FclsvC7ertn8IDeBVjhCknFTN17UIaU",{"id":3211,"category":3162,"definition":3212,"example":3213,"extension":1307,"meta":3214,"stem":3219,"term":1067,"__hash__":3220},"glossary\u002Fglossary\u002Fcompass.md","A compass senses which way you are facing and turns it into a number your code can read, from 0 all the way round to 359. North is 0, east is 90, south is 180 and west is 270.","Like the little arrow on a map app that swings round as you turn, a compass tells your code which way you are pointing.",{"body":3215},{"type":7,"value":3216,"toc":3217},[],{"title":151,"searchDepth":206,"depth":206,"links":3218},[],"glossary\u002Fcompass","OLHOUB2juBbFNqrj6mKvU8g2AjtBuCQZnsdV_3fkW-w",{"id":3222,"category":3223,"definition":3224,"example":3225,"extension":1307,"meta":3226,"stem":3231,"term":3232,"__hash__":3233},"glossary\u002Fglossary\u002Fforever-loop.md","Programming","A forever loop repeats its instructions again and again without ever stopping (until you switch off or reset). It's perfect for anything you want to keep happening over and over.","Like a clock's second hand that keeps ticking round and round, a forever loop keeps running the same steps over and over.",{"body":3227},{"type":7,"value":3228,"toc":3229},[],{"title":151,"searchDepth":206,"depth":206,"links":3230},[],"glossary\u002Fforever-loop","Forever loop","1j2cYaiR3yKeoh54w9Vg2aWr_cEXEtj7F0WCR3_jdc0",{"id":3235,"category":3236,"definition":3237,"example":3238,"extension":1307,"meta":3239,"stem":3244,"term":3245,"__hash__":3246},"glossary\u002Fglossary\u002Ffrequency.md","Electronics","A frequency is just a number that tells a buzzer which note to play. A small number makes a low sound, and a big number makes a high sound.","Setting a buzzer to a low number gives a deep, rumbly note, while a high number makes a squeaky, high-pitched one, a bit like the left and right ends of a piano.",{"body":3240},{"type":7,"value":3241,"toc":3242},[],{"title":151,"searchDepth":206,"depth":206,"links":3243},[],"glossary\u002Ffrequency","Frequency","XY4AeY0bsJaqF0XBjkEAvTSzqxdpPPLt09Z_LbZSjPg",{"id":3248,"category":3223,"definition":3249,"example":3250,"extension":1307,"meta":3251,"stem":3256,"term":3257,"__hash__":3258},"glossary\u002Fglossary\u002Ffunction.md","A function is a chunk of code you give a name to, so you can use it again and again without building it from scratch each time. Think of it like a favourite recipe, you write down the steps once, then follow it whenever you need it.","Like writing out a pancake recipe once. Whenever you fancy pancakes, you just follow the recipe again rather than working it all out from scratch.",{"body":3252},{"type":7,"value":3253,"toc":3254},[],{"title":151,"searchDepth":206,"depth":206,"links":3255},[],"glossary\u002Ffunction","Function","0aEVvGRMWsAC1qXngj6QCHxCoIn1mWfHYBBi95ayuLE",{"id":3260,"category":3261,"definition":3262,"example":3263,"extension":1307,"meta":3264,"stem":3269,"term":3270,"__hash__":3271},"glossary\u002Fglossary\u002Fide-code-editor.md","General","An IDE is the program where you write and run your code. A code editor lots of children and parents will already know is Scratch, where you drag blocks together to build a program. IDE stands for \"integrated development environment\".","It's like a kitchen for code: one place with all the tools you need to put your project together and test it.",{"body":3265},{"type":7,"value":3266,"toc":3267},[],{"title":151,"searchDepth":206,"depth":206,"links":3268},[],"glossary\u002Fide-code-editor","IDE (code editor)","yc7Eds8WdmrIM56FGlCmMtjhoodKwT1IUvQCC9bsvKs",{"id":3273,"category":3199,"definition":3274,"example":3275,"extension":1307,"meta":3276,"stem":3281,"term":3282,"__hash__":3283},"glossary\u002Fglossary\u002Fif-statement.md","An if statement checks whether something is true, and only runs its instructions when it is. It's how code makes decisions.","\"If it's cold, put on a coat.\" If it's warm, you skip the coat, the action only happens when the check is true.",{"body":3277},{"type":7,"value":3278,"toc":3279},[],{"title":151,"searchDepth":206,"depth":206,"links":3280},[],"glossary\u002Fif-statement","If statement","3uYmpX5sGUnkc327qCP_EkL6IGkFiginfOP39Kstry8",{"id":3285,"category":3223,"definition":3286,"example":3287,"extension":1307,"meta":3288,"stem":3293,"term":3294,"__hash__":3295},"glossary\u002Fglossary\u002Fimporting-libraries.md","A library is a ready-made bundle of code that someone else has written for you. Importing a library means bringing it into your project so you can use all its ready-made commands and features, without building them from scratch.","It's like borrowing a recipe book from the library. Instead of working out every recipe yourself, you bring the book in and use the recipes whenever you need them.",{"body":3289},{"type":7,"value":3290,"toc":3291},[],{"title":151,"searchDepth":206,"depth":206,"links":3292},[],"glossary\u002Fimporting-libraries","Importing Libraries","Wqj3o2kxbFQa44LtzhYfeDYluwIPxxWChkL00OD1LqI",{"id":3297,"category":3298,"definition":3299,"example":3300,"extension":1307,"meta":3301,"stem":3306,"term":3307,"__hash__":3308},"glossary\u002Fglossary\u002Finteger.md","Data & Variables","An integer is just a whole number, like 1, 2 or 3. It has no bits after a dot, so 4 is an integer, but 4.5 isn't.","Counting down 3… 2… 1… uses integers, but a price like £4.99 isn't an integer because it has numbers after the dot.",{"body":3302},{"type":7,"value":3303,"toc":3304},[],{"title":151,"searchDepth":206,"depth":206,"links":3305},[],"glossary\u002Finteger","Integer","lktbVeg3VEBLF2Jg3R_EKdjEowVZeabE1gPnGpI2OXY",{"id":3310,"category":3162,"definition":3311,"example":3312,"extension":1307,"meta":3313,"stem":3318,"term":3319,"__hash__":3320},"glossary\u002Fglossary\u002Fled.md","An LED is a tiny light you can switch on and off (and sometimes change colour) with your code. LED is short for \"light-emitting diode\".","The little standby light on a TV is an LED, your code can flash one on and off the same way.",{"body":3314},{"type":7,"value":3315,"toc":3316},[],{"title":151,"searchDepth":206,"depth":206,"links":3317},[],"glossary\u002Fled","LED","M41j-xq46HhMvOjtpYSjfy0ypnoMYVzgeqVGSuyVciY",{"id":3322,"category":3162,"definition":3323,"example":3324,"extension":1307,"meta":3325,"stem":3330,"term":3331,"__hash__":3332},"glossary\u002Fglossary\u002Fled-matrix.md","The LED matrix is the grid of little red lights on the front of the micro:bit. By switching them on and off in patterns, your code can show numbers, letters and tiny pictures.","Like a mini scoreboard made of dots, the LED matrix lights up to spell out your step count.",{"body":3326},{"type":7,"value":3327,"toc":3328},[],{"title":151,"searchDepth":206,"depth":206,"links":3329},[],"glossary\u002Fled-matrix","LED Matrix","KfPJAm7v5EXlm2ejZZLldfB4w7zOMZQhbrmsqxpqJi8",{"id":3334,"category":3162,"definition":3335,"example":3336,"extension":1307,"meta":3337,"stem":3342,"term":3343,"__hash__":3344},"glossary\u002Fglossary\u002Flight-sensor.md","A light sensor is a little part that measures how bright or dark it is around it, then turns that into a number your code can read. As the light changes, so does the number.","Like the automatic headlights on a car that switch on when it gets dark, a light sensor notices the light dropping and lets your code react.",{"body":3338},{"type":7,"value":3339,"toc":3340},[],{"title":151,"searchDepth":206,"depth":206,"links":3341},[],"glossary\u002Flight-sensor","Light Sensor","tEERMTJO24JmYYlQoIO7DxY9yXg0GNehs78E_LQL28U",{"id":3346,"category":3162,"definition":3347,"example":3348,"extension":1307,"meta":3349,"stem":3354,"term":27,"__hash__":3355},"glossary\u002Fglossary\u002Fmicro-bit.md","The micro:bit is a tiny programmable computer, about the size of a matchbox, made for learning to code. It has two buttons, a grid of little red LED lights and built-in sensors that can detect movement, light and temperature.","A bit like a pocket-sized computer you can program yourself, a micro:bit can become a step counter, a thermometer or even a simple game.",{"body":3350},{"type":7,"value":3351,"toc":3352},[],{"title":151,"searchDepth":206,"depth":206,"links":3353},[],"glossary\u002Fmicro-bit","GZPIPrw-9_LkW4seKGxZt6hAdg8MO_A_wOS-mN4qDTg",{"id":3357,"category":3261,"definition":3358,"example":3359,"extension":1307,"meta":3360,"stem":3365,"term":3366,"__hash__":3367},"glossary\u002Fglossary\u002Fmillisecond.md","A millisecond is a tiny slice of time. There are 1,000 of them in just one second! That's why it's perfect for measuring things that happen really fast.","A blink of an eye takes around 300 milliseconds, so a really quick button press might be even faster than a blink.",{"body":3361},{"type":7,"value":3362,"toc":3363},[],{"title":151,"searchDepth":206,"depth":206,"links":3364},[],"glossary\u002Fmillisecond","Millisecond","2TwuImc8S9MyMSqRFO3i6iHVCdsxyJ_S9N_BxGbZL-8",{"id":3369,"category":3162,"definition":3370,"example":3371,"extension":1307,"meta":3372,"stem":3377,"term":3378,"__hash__":3379},"glossary\u002Fglossary\u002Fmodule.md","A module is a small part that does one job, like a buzzer, a button or a screen. You connect modules to the main board to give your project new powers.","Like adding different attachments to a toy, each module snaps on to add a new ability, sound, light or buttons.",{"body":3373},{"type":7,"value":3374,"toc":3375},[],{"title":151,"searchDepth":206,"depth":206,"links":3376},[],"glossary\u002Fmodule","Module","IDLrS2CrlwNauzAWoCd7V16aO_ygDWyjp11bMsfuwO0",{"id":3381,"category":3162,"definition":3382,"example":3383,"extension":1307,"meta":3384,"stem":3389,"term":3390,"__hash__":3391},"glossary\u002Fglossary\u002Fmotor-controller.md","A motor controller is the part that sits between your board and a motor, passing on the right amount of power so the motor moves the way your code asks.","Like a remote control for a toy car, it takes your instructions and makes the motor do them.",{"body":3385},{"type":7,"value":3386,"toc":3387},[],{"title":151,"searchDepth":206,"depth":206,"links":3388},[],"glossary\u002Fmotor-controller","Motor controller","McSSBLd3fPtYq-o2LUQBhW3pBeEmMSjF6cnb2O9ectE",{"id":3393,"category":3162,"definition":3394,"example":3395,"extension":1307,"meta":3396,"stem":3401,"term":3402,"__hash__":3403},"glossary\u002Fglossary\u002Foled-screen.md","An OLED screen is a small display that shows words, numbers and pictures from your code. On some kits it's labelled the \"LED display\", but it's the same little screen.","Like the small screen on a fitness watch showing your steps, an OLED screen can show a score or a countdown.",{"body":3397},{"type":7,"value":3398,"toc":3399},[],{"title":151,"searchDepth":206,"depth":206,"links":3400},[],"glossary\u002Foled-screen","OLED screen","14SaCtmWj71MOziFuPIW377cynK4FRv5TsdEx4fGGFk",{"id":3405,"category":3162,"definition":3406,"example":3407,"extension":1307,"meta":3408,"stem":3413,"term":3414,"__hash__":3415},"glossary\u002Fglossary\u002Fpicobricks.md","PicoBricks is an all-in-one coding kit that joins up handy parts, like a screen, a buzzer, buttons and lights, onto one board, so you can build projects without any fiddly wiring.","It's a bit like a Lego baseboard for electronics: everything clicks together in one place, ready to code.",{"body":3409},{"type":7,"value":3410,"toc":3411},[],{"title":151,"searchDepth":206,"depth":206,"links":3412},[],"glossary\u002Fpicobricks","PicoBricks","TeGs24I-3fkAdlpiuQPPBDUO8EKBe8PS1ewHaj-w5_s",{"id":3417,"category":3162,"definition":3418,"example":3419,"extension":1307,"meta":3420,"stem":3425,"term":3426,"__hash__":3427},"glossary\u002Fglossary\u002Fpotentiometer.md","A potentiometer is a knob or dial that controls how much electricity flows through a circuit. Think of it like a tap for water: turn it one way and more comes out, turn it the other way and less comes out.","A volume dial on a speaker is a potentiometer, turn it up for louder sound and down for quieter.",{"body":3421},{"type":7,"value":3422,"toc":3423},[],{"title":151,"searchDepth":206,"depth":206,"links":3424},[],"glossary\u002Fpotentiometer","Potentiometer","ohP2krcKZLkMtpI44R32nhDVwImLmSBQWP6SOArsh6M",{"id":3429,"category":3223,"definition":3430,"example":3431,"extension":1307,"meta":3432,"stem":3437,"term":3438,"__hash__":3439},"glossary\u002Fglossary\u002Frandom.md","Random means you can't guess what's coming next, a bit like rolling a dice. The computer picks for you, so you get a different surprise each time.","Asking a computer for a random number between 1 and 6 is just like rolling a dice, you never know if you'll get a 1 or a 6.",{"body":3433},{"type":7,"value":3434,"toc":3435},[],{"title":151,"searchDepth":206,"depth":206,"links":3436},[],"glossary\u002Frandom","Random","LkGfQKwUNfJ_TPXihwPveX2JeJ9-BB7DpUire9a2pqI",{"id":3441,"category":3162,"definition":3442,"example":3443,"extension":1307,"meta":3444,"stem":3449,"term":3450,"__hash__":3451},"glossary\u002Fglossary\u002Fraspberry-pi-pico.md","The Raspberry Pi Pico is a tiny, low-cost computer chip on a small board. It's the \"brain\" that stores your code and tells the other parts what to do.","It's like the brain inside a toy robot, small enough to fit in your hand, but clever enough to run your whole project.",{"body":3445},{"type":7,"value":3446,"toc":3447},[],{"title":151,"searchDepth":206,"depth":206,"links":3448},[],"glossary\u002Fraspberry-pi-pico","Raspberry Pi Pico","HVa7r-PC6I5-DVcDdOULsBHP6h7V4SafhFtdazcSWYg",{"id":3453,"category":3223,"definition":3454,"example":3455,"extension":1307,"meta":3456,"stem":3461,"term":3462,"__hash__":3463},"glossary\u002Fglossary\u002Frepeat-loop.md","A repeat loop does its instructions a set number of times, then stops. You tell it exactly how many goes you want.","\"Repeat 3 times: blow out a candle.\" After the third candle, the loop is finished, no matter what.",{"body":3457},{"type":7,"value":3458,"toc":3459},[],{"title":151,"searchDepth":206,"depth":206,"links":3460},[],"glossary\u002Frepeat-loop","Repeat loop","YC2iTUQ841lfmltd6Pkq89uuQbk29RWgR-rWs7MvjJ4",{"id":3465,"category":3162,"definition":3466,"example":3467,"extension":1307,"meta":3468,"stem":3473,"term":3474,"__hash__":3475},"glossary\u002Fglossary\u002Frgb-led.md","An RGB LED is a tiny light that can glow in any colour you like. It mixes red, green and blue light in different amounts, a bit like mixing paints, to make all sorts of colours.","Like the colour-changing lights some people put behind their TV, an RGB LED can shift from red to green to blue and everything in between.",{"body":3469},{"type":7,"value":3470,"toc":3471},[],{"title":151,"searchDepth":206,"depth":206,"links":3472},[],"glossary\u002Frgb-led","RGB LED","mIu-76nYeQtI-NsTMcvPueLH11JE0fC5X2jJxBmKwPU",{"id":3477,"category":3162,"definition":3478,"example":3479,"extension":1307,"meta":3480,"stem":3485,"term":3486,"__hash__":3487},"glossary\u002Fglossary\u002Fservo-motor.md","A servo motor is a special motor that turns to an exact position you tell it, like 0 or 90 degrees, instead of just spinning round and round.","Like the hand on a clock moving to point at a number, a servo turns to the exact angle you ask for.",{"body":3481},{"type":7,"value":3482,"toc":3483},[],{"title":151,"searchDepth":206,"depth":206,"links":3484},[],"glossary\u002Fservo-motor","Servo motor","IFtMLIEoNZ746ebquvkvp-PAqDQObQACMiWUTb3rfZ8",{"id":3489,"category":3162,"definition":3490,"example":3491,"extension":1307,"meta":3492,"stem":3497,"term":3498,"__hash__":3499},"glossary\u002Fglossary\u002Ftemperature-sensor.md","A temperature sensor is a little part that measures how warm or cold it is around it, then turns that into a number your code can read. As the room heats up or cools down, the number changes too.","Like the thermometer that tells you if you've got a temperature when you're poorly, a temperature sensor measures the warmth around it and gives your code a number to work with.",{"body":3493},{"type":7,"value":3494,"toc":3495},[],{"title":151,"searchDepth":206,"depth":206,"links":3496},[],"glossary\u002Ftemperature-sensor","Temperature sensor","UbSScS-TCPLSFDjnxsaFltpoKbORTAOaxh68b_-FMw8",{"id":3501,"category":3199,"definition":3502,"example":3503,"extension":1307,"meta":3504,"stem":3509,"term":3510,"__hash__":3511},"glossary\u002Fglossary\u002Fthreshold.md","A threshold is a cut-off number you pick to help your code make a decision. The code checks whether a value is above or below it, then acts. It's like drawing a line and asking \"are we over it or under it?\"","Like setting a bedtime of 8 o'clock: before 8 you're still up, after 8 it's lights out. The time is your threshold.",{"body":3505},{"type":7,"value":3506,"toc":3507},[],{"title":151,"searchDepth":206,"depth":206,"links":3508},[],"glossary\u002Fthreshold","Threshold","xikcgh-PcWY0Z_HhDY16B8SLJLbL0oJD8WUU3KpHqvY",{"id":3513,"category":3298,"definition":3514,"example":3515,"extension":1307,"meta":3516,"stem":3521,"term":3522,"__hash__":3523},"glossary\u002Fglossary\u002Fvariable.md","A variable is something that can change. Think of it like a labelled box: you pop something inside, and the label tells you what it is. You can swap what's inside whenever you like.","A variable called score might start at 0, then change to 1, 2 and 3 as you collect points in a game.",{"body":3517},{"type":7,"value":3518,"toc":3519},[],{"title":151,"searchDepth":206,"depth":206,"links":3520},[],"glossary\u002Fvariable","Variable","nlzJUTSGqyIAKSbopFF01oPBuJT59zOT7MSoCpOMp1E",{"id":3525,"category":3223,"definition":3526,"example":3527,"extension":1307,"meta":3528,"stem":3533,"term":3534,"__hash__":3535},"glossary\u002Fglossary\u002Fwhile-loop.md","A while loop keeps repeating its instructions for as long as something stays true. The moment that thing stops being true, the loop stops.","\"While it's still raining, keep the umbrella up.\" As soon as the rain stops, you put the umbrella down, and the loop ends.",{"body":3529},{"type":7,"value":3530,"toc":3531},[],{"title":151,"searchDepth":206,"depth":206,"links":3532},[],"glossary\u002Fwhile-loop","While loop","igK-e_snGhkP0kgSn6sPO7YQybQ0WpDfQMB0_8I2iZg",[3537,3543,3549,3555,3561,3567,3573,3579,3585,3591,3597,3603,3609,3615,3621,3627,3633,3639,3645,3651,3657,3663,3669,3675,3681,3687,3693,3699,3705,3711,3717],{"id":3161,"category":3162,"definition":3163,"example":3164,"extension":1307,"meta":3538,"stem":3170,"term":3171,"__hash__":3172},{"body":3539},{"type":7,"value":3540,"toc":3541},[],{"title":151,"searchDepth":206,"depth":206,"links":3542},[],{"id":3174,"category":3162,"definition":3175,"example":3176,"extension":1307,"meta":3544,"stem":3182,"term":3183,"__hash__":3184},{"body":3545},{"type":7,"value":3546,"toc":3547},[],{"title":151,"searchDepth":206,"depth":206,"links":3548},[],{"id":3186,"category":3162,"definition":3187,"example":3188,"extension":1307,"meta":3550,"stem":3194,"term":3195,"__hash__":3196},{"body":3551},{"type":7,"value":3552,"toc":3553},[],{"title":151,"searchDepth":206,"depth":206,"links":3554},[],{"id":3198,"category":3199,"definition":3200,"example":3201,"extension":1307,"meta":3556,"stem":3207,"term":3208,"__hash__":3209},{"body":3557},{"type":7,"value":3558,"toc":3559},[],{"title":151,"searchDepth":206,"depth":206,"links":3560},[],{"id":3211,"category":3162,"definition":3212,"example":3213,"extension":1307,"meta":3562,"stem":3219,"term":1067,"__hash__":3220},{"body":3563},{"type":7,"value":3564,"toc":3565},[],{"title":151,"searchDepth":206,"depth":206,"links":3566},[],{"id":3222,"category":3223,"definition":3224,"example":3225,"extension":1307,"meta":3568,"stem":3231,"term":3232,"__hash__":3233},{"body":3569},{"type":7,"value":3570,"toc":3571},[],{"title":151,"searchDepth":206,"depth":206,"links":3572},[],{"id":3235,"category":3236,"definition":3237,"example":3238,"extension":1307,"meta":3574,"stem":3244,"term":3245,"__hash__":3246},{"body":3575},{"type":7,"value":3576,"toc":3577},[],{"title":151,"searchDepth":206,"depth":206,"links":3578},[],{"id":3248,"category":3223,"definition":3249,"example":3250,"extension":1307,"meta":3580,"stem":3256,"term":3257,"__hash__":3258},{"body":3581},{"type":7,"value":3582,"toc":3583},[],{"title":151,"searchDepth":206,"depth":206,"links":3584},[],{"id":3260,"category":3261,"definition":3262,"example":3263,"extension":1307,"meta":3586,"stem":3269,"term":3270,"__hash__":3271},{"body":3587},{"type":7,"value":3588,"toc":3589},[],{"title":151,"searchDepth":206,"depth":206,"links":3590},[],{"id":3273,"category":3199,"definition":3274,"example":3275,"extension":1307,"meta":3592,"stem":3281,"term":3282,"__hash__":3283},{"body":3593},{"type":7,"value":3594,"toc":3595},[],{"title":151,"searchDepth":206,"depth":206,"links":3596},[],{"id":3285,"category":3223,"definition":3286,"example":3287,"extension":1307,"meta":3598,"stem":3293,"term":3294,"__hash__":3295},{"body":3599},{"type":7,"value":3600,"toc":3601},[],{"title":151,"searchDepth":206,"depth":206,"links":3602},[],{"id":3297,"category":3298,"definition":3299,"example":3300,"extension":1307,"meta":3604,"stem":3306,"term":3307,"__hash__":3308},{"body":3605},{"type":7,"value":3606,"toc":3607},[],{"title":151,"searchDepth":206,"depth":206,"links":3608},[],{"id":3310,"category":3162,"definition":3311,"example":3312,"extension":1307,"meta":3610,"stem":3318,"term":3319,"__hash__":3320},{"body":3611},{"type":7,"value":3612,"toc":3613},[],{"title":151,"searchDepth":206,"depth":206,"links":3614},[],{"id":3322,"category":3162,"definition":3323,"example":3324,"extension":1307,"meta":3616,"stem":3330,"term":3331,"__hash__":3332},{"body":3617},{"type":7,"value":3618,"toc":3619},[],{"title":151,"searchDepth":206,"depth":206,"links":3620},[],{"id":3334,"category":3162,"definition":3335,"example":3336,"extension":1307,"meta":3622,"stem":3342,"term":3343,"__hash__":3344},{"body":3623},{"type":7,"value":3624,"toc":3625},[],{"title":151,"searchDepth":206,"depth":206,"links":3626},[],{"id":3357,"category":3261,"definition":3358,"example":3359,"extension":1307,"meta":3628,"stem":3365,"term":3366,"__hash__":3367},{"body":3629},{"type":7,"value":3630,"toc":3631},[],{"title":151,"searchDepth":206,"depth":206,"links":3632},[],{"id":3369,"category":3162,"definition":3370,"example":3371,"extension":1307,"meta":3634,"stem":3377,"term":3378,"__hash__":3379},{"body":3635},{"type":7,"value":3636,"toc":3637},[],{"title":151,"searchDepth":206,"depth":206,"links":3638},[],{"id":3381,"category":3162,"definition":3382,"example":3383,"extension":1307,"meta":3640,"stem":3389,"term":3390,"__hash__":3391},{"body":3641},{"type":7,"value":3642,"toc":3643},[],{"title":151,"searchDepth":206,"depth":206,"links":3644},[],{"id":3393,"category":3162,"definition":3394,"example":3395,"extension":1307,"meta":3646,"stem":3401,"term":3402,"__hash__":3403},{"body":3647},{"type":7,"value":3648,"toc":3649},[],{"title":151,"searchDepth":206,"depth":206,"links":3650},[],{"id":3405,"category":3162,"definition":3406,"example":3407,"extension":1307,"meta":3652,"stem":3413,"term":3414,"__hash__":3415},{"body":3653},{"type":7,"value":3654,"toc":3655},[],{"title":151,"searchDepth":206,"depth":206,"links":3656},[],{"id":3417,"category":3162,"definition":3418,"example":3419,"extension":1307,"meta":3658,"stem":3425,"term":3426,"__hash__":3427},{"body":3659},{"type":7,"value":3660,"toc":3661},[],{"title":151,"searchDepth":206,"depth":206,"links":3662},[],{"id":3465,"category":3162,"definition":3466,"example":3467,"extension":1307,"meta":3664,"stem":3473,"term":3474,"__hash__":3475},{"body":3665},{"type":7,"value":3666,"toc":3667},[],{"title":151,"searchDepth":206,"depth":206,"links":3668},[],{"id":3429,"category":3223,"definition":3430,"example":3431,"extension":1307,"meta":3670,"stem":3437,"term":3438,"__hash__":3439},{"body":3671},{"type":7,"value":3672,"toc":3673},[],{"title":151,"searchDepth":206,"depth":206,"links":3674},[],{"id":3441,"category":3162,"definition":3442,"example":3443,"extension":1307,"meta":3676,"stem":3449,"term":3450,"__hash__":3451},{"body":3677},{"type":7,"value":3678,"toc":3679},[],{"title":151,"searchDepth":206,"depth":206,"links":3680},[],{"id":3453,"category":3223,"definition":3454,"example":3455,"extension":1307,"meta":3682,"stem":3461,"term":3462,"__hash__":3463},{"body":3683},{"type":7,"value":3684,"toc":3685},[],{"title":151,"searchDepth":206,"depth":206,"links":3686},[],{"id":3477,"category":3162,"definition":3478,"example":3479,"extension":1307,"meta":3688,"stem":3485,"term":3486,"__hash__":3487},{"body":3689},{"type":7,"value":3690,"toc":3691},[],{"title":151,"searchDepth":206,"depth":206,"links":3692},[],{"id":3489,"category":3162,"definition":3490,"example":3491,"extension":1307,"meta":3694,"stem":3497,"term":3498,"__hash__":3499},{"body":3695},{"type":7,"value":3696,"toc":3697},[],{"title":151,"searchDepth":206,"depth":206,"links":3698},[],{"id":3501,"category":3199,"definition":3502,"example":3503,"extension":1307,"meta":3700,"stem":3509,"term":3510,"__hash__":3511},{"body":3701},{"type":7,"value":3702,"toc":3703},[],{"title":151,"searchDepth":206,"depth":206,"links":3704},[],{"id":3513,"category":3298,"definition":3514,"example":3515,"extension":1307,"meta":3706,"stem":3521,"term":3522,"__hash__":3523},{"body":3707},{"type":7,"value":3708,"toc":3709},[],{"title":151,"searchDepth":206,"depth":206,"links":3710},[],{"id":3525,"category":3223,"definition":3526,"example":3527,"extension":1307,"meta":3712,"stem":3533,"term":3534,"__hash__":3535},{"body":3713},{"type":7,"value":3714,"toc":3715},[],{"title":151,"searchDepth":206,"depth":206,"links":3716},[],{"id":3346,"category":3162,"definition":3347,"example":3348,"extension":1307,"meta":3718,"stem":3354,"term":27,"__hash__":3355},{"body":3719},{"type":7,"value":3720,"toc":3721},[],{"title":151,"searchDepth":206,"depth":206,"links":3722},[],1790263487770]