{"id":696,"date":"2026-11-22T20:42:26","date_gmt":"2026-11-22T20:42:26","guid":{"rendered":"https:\/\/ndovu.org.uk\/cs\/?p=696"},"modified":"2026-11-22T20:47:33","modified_gmt":"2026-11-22T20:47:33","slug":"yr-6-1-2-2-inputs-event-driven-programming","status":"publish","type":"post","link":"https:\/\/ndovu.org.uk\/cs\/yr-6-1-2-2-inputs-event-driven-programming\/","title":{"rendered":"Yr 6 1.2.2 Inputs &amp; Event-Driven Programming"},"content":{"rendered":"\n<p><strong>Welcome to Year 6 Computing \u2014 Micro:bit Lesson 2: Inputs &amp; Events! \ud83c\udf9b\ufe0f\u26a1<\/strong><\/p>\n<p>Last week, our code ran the exact second the micro:bit turned on. Today, we are going to take control! We will use <strong>Inputs<\/strong> (like buttons and sensors) to trigger our code using a technique called <strong>Event-Driven Programming<\/strong>.<\/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-10:<\/strong> Create programs that include sequences, events, loops, and conditionals.<\/li>\n    <li><strong>ISTE 1.5.c:<\/strong> Break problems into component parts, extract key information, and develop descriptive models.<\/li>\n    <li><strong>UK NC:<\/strong> Design, write and debug programs that control or simulate physical systems.<\/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>input, output, event, trigger, accelerometer, sequence.<\/em><\/li>\n<\/ul>\n\n<p><strong>Step 2: What is an Event? \ud83c\udfac (5 Mins)<\/strong><\/p>\n<p>In computing, an <strong>Event<\/strong> is an action that the computer is waiting for. For example, &#8220;When Button A is pressed&#8221; is an event. The computer sits and waits, and as soon as the event happens, it runs the blocks inside it!<\/p>\n\n<p><strong>Step 3: Micro:bit Classroom &#8211; Step-by-Step \ud83d\udee0\ufe0f (10 Mins)<\/strong><\/p>\n<p>Let&#8217;s program our first Input event! Log into your teacher&#8217;s <strong>Micro:bit Classroom<\/strong>.<\/p>\n<ol style=\"line-height: 1.6;\">\n  <li>Look at the blue menu on the left. Click on the pink <strong>Input<\/strong> category.<\/li>\n  <li>Click and drag the <strong>on button A pressed<\/strong> block onto your workspace. (Notice it is not a loop; it has a flat top!).<\/li>\n  <li>Go to the <strong>Basic<\/strong> menu and drag a <strong>show icon<\/strong> block <em>inside<\/em> the Button A block.<\/li>\n  <li>Change the icon to a Happy Face.<\/li>\n  <li>Look at the simulator on the left of your screen. Click the virtual &#8220;A&#8221; button. What happens?<\/li>\n<\/ol>\n\n<p><strong>Step 4: The Advanced Digital Pet Challenge \ud83d\udc36 (25 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 an Interactive Pet!<\/h4>\n  <p style=\"margin-bottom: 10px;\">You know how to make the micro:bit react to Button A. Now, you must combine <strong>Events<\/strong> (from today) with <strong>Sequences and Pauses<\/strong> (from last week) to make a realistic digital pet! <strong>Experiment, test, and debug it yourself!<\/strong><\/p>\n  <ul style=\"margin-bottom: 0;\">\n    <li><strong>Rule 1 (Feed):<\/strong> When you press <strong>Button A<\/strong>, the pet must show a Happy face, pause for 1 second, and then clear the screen (go back to neutral).<\/li>\n    <li><strong>Rule 2 (Scold):<\/strong> When you press <strong>Button B<\/strong>, the pet must show a Sad face.<\/li>\n    <li><strong>Rule 3 (Dizzy):<\/strong> When you <strong>Shake<\/strong> the micro:bit, the pet must show a Dizzy animation (two icons alternating), then automatically fall Asleep.<\/li>\n    <li><strong>Rule 4 (Wake Up):<\/strong> Can you figure out how to program the <strong>A+B<\/strong> button to wake the pet up with a Surprised face?<\/li>\n    <li><strong>Bonus:<\/strong> Download your `.hex` file to your real micro:bit and test your pet!<\/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 Inputs and Events. 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;\">Inputs &amp; Events 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 &#8220;Event-Driven Programming&#8221; means in your own words.<\/label>\n  <textarea id=\"ref-q1\" rows=\"2\" placeholder=\"It means that the computer waits for...\" 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. How did you make the pet clear its screen or change expression AFTER an event was triggered?<\/label>\n  <textarea id=\"ref-q2\" rows=\"2\" placeholder=\"To make it change expression over time, I combined the event with 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;\">3. What was the hardest bug to fix in your Digital Pet&#8217;s code today?<\/label>\n  <textarea id=\"ref-q3\" rows=\"2\" placeholder=\"The hardest part to debug was...\" 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<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(\"Inputs & Events 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 Event-Driven Programming?\",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. Changing expression over time:\",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. Hardest bug to fix:\",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_L2_\"+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 2: Inputs &amp; Events! \ud83c\udf9b\ufe0f\u26a1 Last week, our code ran the exact second the micro:bit turned on.&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/ndovu.org.uk\/cs\/yr-6-1-2-2-inputs-event-driven-programming\/\">Continue Reading<span class=\"screen-reader-text\">Yr 6 1.2.2 Inputs &amp; Event-Driven Programming<\/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-696","post","type-post","status-publish","format-standard","hentry","category-year6","entry"],"_links":{"self":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/696","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=696"}],"version-history":[{"count":3,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/696\/revisions"}],"predecessor-version":[{"id":701,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/696\/revisions\/701"}],"wp:attachment":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/media?parent=696"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/categories?post=696"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/tags?post=696"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}