{"id":702,"date":"2026-11-22T20:49:49","date_gmt":"2026-11-22T20:49:49","guid":{"rendered":"https:\/\/ndovu.org.uk\/cs\/?p=702"},"modified":"2026-11-22T20:52:37","modified_gmt":"2026-11-22T20:52:37","slug":"yr-6-1-2-3-variables-data","status":"publish","type":"post","link":"https:\/\/ndovu.org.uk\/cs\/yr-6-1-2-3-variables-data\/","title":{"rendered":"Yr 6 1.2.3 Variables &amp; Data."},"content":{"rendered":"\n<p><strong>Welcome to Year 6 Computing \u2014 Micro:bit Lesson 3: Variables &amp; Data! \ud83e\uddee\ud83d\udeb6\u200d\u2642\ufe0f<\/strong><\/p>\n<p>If you play a video game, how does the computer remember your score? It uses a <strong>Variable<\/strong>! Today, we are going to learn how to store and change data by programming our micro:bits to act as a pedometer (a step counter).<\/p>\n\n<div style=\"background-color: #e8f5e9; border-left: 5px solid #4caf50; padding: 15px; border-radius: 5px; margin-bottom: 20px;\">\n  <p style=\"margin: 0; font-size: 14px;\"><strong>Target Standards:<\/strong><\/p>\n  <ul style=\"margin-top: 5px; margin-bottom: 0; font-size: 13px;\">\n    <li><strong>CSTA 1B-AP-09:<\/strong> Create programs that use variables to store and modify data.<\/li>\n    <li><strong>ISTE 1.5.c:<\/strong> Break problems into component parts and develop descriptive models.<\/li>\n    <li><strong>UK NC:<\/strong> Use variables in programs; design, write and debug programs that accomplish specific goals.<\/li>\n  <\/ul>\n<\/div>\n\n<p><strong>Step 1: Keyboard Warm-up \u2328\ufe0f (10 Mins)<\/strong><\/p>\n<ul>\n  <li>Click here to warm up your fingers: <a href=\"https:\/\/ndovu.org.uk\/type\/\" target=\"_blank\" rel=\"noopener\">Start Typing Practice on Ndovu<\/a>.<\/li>\n  <li>Today&#8217;s keywords: <em>variable, data, store, modify, step counter, reset.<\/em><\/li>\n<\/ul>\n\n<p><strong>Step 2: What is a Variable? \ud83c\udfac (5 Mins)<\/strong><\/p>\n<p>Imagine a variable as a digital box with a label on it. You can put information inside the box (like a number or a word), and you can look inside the box or change what is in it at any time. We call it a <em>variable<\/em> because the information inside can <em>vary<\/em> (change)!<\/p>\n\n<p><strong>Step 3: Micro:bit Classroom &#8211; Step-by-Step \ud83d\udee0\ufe0f (15 Mins)<\/strong><\/p>\n<p>Let&#8217;s program our step counter! Log into your teacher&#8217;s <strong>Micro:bit Classroom<\/strong>.<\/p>\n<ol style=\"line-height: 1.6;\">\n  <li>Go to the red <strong>Variables<\/strong> menu and click <em>Make a Variable<\/em>. Name it <strong>steps<\/strong> and click OK.<\/li>\n  <li>Drag the <strong>set steps to 0<\/strong> block into the blue <strong>on start<\/strong> loop. (This ensures our pedometer starts at zero when it turns on!).<\/li>\n  <li>Go to the pink <strong>Input<\/strong> menu and drag an <strong>on shake<\/strong> block onto your workspace.<\/li>\n  <li>Go back to the red <strong>Variables<\/strong> menu and drag the <strong>change steps by 1<\/strong> block <em>inside<\/em> the shake block.<\/li>\n  <li>Finally, to see our score, go to the <strong>Basic<\/strong> menu and drag <strong>show number<\/strong> inside the shake block (underneath the change block). Replace the &#8220;0&#8221; with your red <strong>steps<\/strong> variable!<\/li>\n<\/ol>\n\n<p><strong>Step 4: The Reset Challenge \ud83e\udde9 (20 Mins)<\/strong><\/p>\n<div style=\"background-color: #fff9c4; border: 2px solid #fbc02d; padding: 15px; border-radius: 8px; margin-bottom: 20px;\">\n  <h4 style=\"margin-top: 0; color: #f57f17;\">Mission: Build a Reset Button!<\/h4>\n  <p style=\"margin-bottom: 10px;\">Your step counter works beautifully, but what happens when you want to start a new walk? If you don&#8217;t reset it, it will just keep counting forever! <strong>Can you figure out how to program a reset button yourself?<\/strong><\/p>\n  <ul style=\"margin-bottom: 0;\">\n    <li><strong>Rule 1 (The Trigger):<\/strong> You must use the <strong>Button A+B<\/strong> event. (Hint: Get an &#8216;A&#8217; button block and use the dropdown arrow to change it).<\/li>\n    <li><strong>Rule 2 (The Data):<\/strong> When A+B is pressed, your <strong>steps<\/strong> variable must go back to zero.<\/li>\n    <li><strong>Rule 3 (The Screen):<\/strong> After the variable resets, the screen must clear so it is totally blank again.<\/li>\n    <li><strong>Bonus:<\/strong> Download your `.hex` file to your real micro:bit. Attach the battery pack, put it in your pocket, and test it by walking around the room!<\/li>\n  <\/ul>\n<\/div>\n\n<p><strong>Step 5: End of Lesson Reflection \ud83d\udc4b (10 Mins)<\/strong><\/p>\n<p>Fill in the reflection tool below to prove your understanding of Variables. Click download to save your certificate!<\/p>\n\n<!-- Reflection Widget -->\n<div id=\"ref-widget\" style=\"max-width: 800px; margin: 20px auto; font-family: Arial, sans-serif; border: 2px solid #ddd; border-radius: 10px; padding: 20px; background-color: #fcfcfc; box-shadow: 0 4px 8px rgba(0,0,0,0.05);\">\n  <h2 style=\"color: #0073aa; margin-top: 0; text-align: center;\">Variables Reflection<\/h2>\n  <label style=\"font-weight: bold; display: block; margin-top: 15px;\">Student Name:<\/label>\n  <input type=\"text\" id=\"ref-name\" placeholder=\"e.g., Sarah Jones\" style=\"width: 100%; max-width: 300px; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 14px;\">\n  \n  <label style=\"font-weight: bold; display: block; margin-top: 15px;\">1. Explain what a Variable is in your own words.<\/label>\n  <textarea id=\"ref-q1\" rows=\"2\" placeholder=\"A variable is like a...\" style=\"width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 14px;\"><\/textarea>\n\n  <label style=\"font-weight: bold; display: block; margin-top: 15px;\">2. Why did we need to use a variable for our step counter instead of just typing a number on the screen?<\/label>\n  <textarea id=\"ref-q2\" rows=\"2\" placeholder=\"If we just typed a normal number, it wouldn't be able to...\" style=\"width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 14px;\"><\/textarea>\n\n  <label style=\"font-weight: bold; display: block; margin-top: 15px;\">3. How did you solve the challenge of resetting the steps back to zero?<\/label>\n  <textarea id=\"ref-q3\" rows=\"2\" placeholder=\"To make the A+B button reset the steps, I had to...\" style=\"width: 100%; padding: 10px; margin-top: 5px; border: 1px solid #ccc; border-radius: 5px; box-sizing: border-box; font-size: 14px;\"><\/textarea>\n\n  <div style=\"text-align: right; margin-top: 25px;\">\n    <button type=\"button\" id=\"btn-ref-dl\" style=\"background-color: #4CAF50; color: white; border: none; padding: 15px 25px; border-radius: 5px; cursor: pointer; font-size: 16px; font-weight: bold;\">\ud83d\udcbe Download Reflection<\/button>\n  <\/div>\n<\/div>\n\n<script>document.addEventListener(\"click\",function(e){var btn=e.target.closest(\"button\");if(!btn)return;var id=btn.id;function w(t,sx,sy,wl,lh){var ws=t.split(String.fromCharCode(32));var cl=\"\";for(var k=0;k!==ws.length;k++){var tl=cl+ws[k]+String.fromCharCode(32);var m=x.measureText(tl);if(Math.max(m.width,wl)!==wl&&k!==0){x.fillText(cl,sx,sy);cl=ws[k]+String.fromCharCode(32);sy+=lh;}else{cl=tl;}}x.fillText(cl,sx,sy);return sy+lh;}if(id===\"btn-ref-dl\"){var rNm=document.getElementById(\"ref-name\").value.trim();var rQ1=document.getElementById(\"ref-q1\").value.trim();var rQ2=document.getElementById(\"ref-q2\").value.trim();var rQ3=document.getElementById(\"ref-q3\").value.trim();if(rNm===\"\"||rQ1===\"\"||rQ2===\"\"||rQ3===\"\"){alert(\"Please fill in your name and all three questions!\");return;}var c=document.createElement(\"canvas\");c.width=800;c.height=850;var x=c.getContext(\"2d\");x.fillStyle=\"#ffffff\";x.fillRect(0,0,c.width,c.height);x.strokeStyle=\"#0073aa\";x.lineWidth=15;x.strokeRect(20,20,c.width-40,c.height-40);x.lineWidth=4;x.strokeRect(30,30,c.width-60,c.height-60);var y=100;x.fillStyle=\"#0073aa\";x.font=\"bold 40px Arial\";x.textAlign=\"center\";x.fillText(\"Variables Reflection\",400,y);y+=70;x.textAlign=\"left\";x.fillStyle=\"#333333\";x.font=\"bold 26px Arial\";x.fillText(\"Student: \"+rNm,50,y);y+=60;x.fillStyle=\"#0073aa\";x.font=\"bold 20px Arial\";x.fillText(\"1. What is a variable?\",50,y);y+=35;x.fillStyle=\"#555555\";x.font=\"normal 20px Arial\";y=w(rQ1,50,y,700,30);y+=40;x.fillStyle=\"#0073aa\";x.font=\"bold 20px Arial\";x.fillText(\"2. Why use a variable for steps?\",50,y);y+=35;x.fillStyle=\"#555555\";x.font=\"normal 20px Arial\";y=w(rQ2,50,y,700,30);y+=40;x.fillStyle=\"#0073aa\";x.font=\"bold 20px Arial\";x.fillText(\"3. How did you code the reset button?\",50,y);y+=35;x.fillStyle=\"#555555\";x.font=\"normal 20px Arial\";y=w(rQ3,50,y,700,30);var ln=document.createElement(\"a\");ln.href=c.toDataURL(\"image\/png\");ln.download=\"Y6_Microbit_L3_\"+rNm.split(String.fromCharCode(32)).join(String.fromCharCode(95))+\".png\";document.body.appendChild(ln);ln.click();document.body.removeChild(ln);alert(\"Reflection Downloaded!\");}});<\/script>\n","protected":false},"excerpt":{"rendered":"<p>Welcome to Year 6 Computing \u2014 Micro:bit Lesson 3: Variables &amp; Data! \ud83e\uddee\ud83d\udeb6\u200d\u2642\ufe0f If you play a video game, how does the computer remember your&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/ndovu.org.uk\/cs\/yr-6-1-2-3-variables-data\/\">Continue Reading<span class=\"screen-reader-text\">Yr 6 1.2.3 Variables &amp; Data.<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kilabel_text_disclosure":"","_kilabel_text_reviewed_by":"","_kilabel_text_reviewed_on":"","_kilabel_text_responsible":"","iawp_total_views":0,"footnotes":""},"categories":[9],"tags":[],"class_list":["post-702","post","type-post","status-publish","format-standard","hentry","category-year6","entry"],"_links":{"self":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/comments?post=702"}],"version-history":[{"count":2,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/702\/revisions"}],"predecessor-version":[{"id":706,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/702\/revisions\/706"}],"wp:attachment":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/media?parent=702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/categories?post=702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/tags?post=702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}