{"id":592,"date":"2025-02-19T11:37:26","date_gmt":"2025-02-19T03:37:26","guid":{"rendered":"https:\/\/code.xedulab.com\/?p=592"},"modified":"2025-03-31T13:50:59","modified_gmt":"2025-03-31T05:50:59","slug":"counter","status":"publish","type":"post","link":"https:\/\/code.xedulab.com\/index.php\/2025\/02\/19\/counter\/","title":{"rendered":"Counter"},"content":{"rendered":"<button class=\"simplefavorite-button has-count preset\" data-postid=\"592\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"box-shadow:none;-webkit-box-shadow:none;-moz-box-shadow:none;background-color:#ffffff;border-color:#ffffff;color:#686868;\"><i class=\"sf-icon-favorite\" style=\"color:#686868;\"><\/i>\u6536\u85cf<span class=\"simplefavorite-button-count\" style=\"\">0<\/span><\/button>\n<p>Introduction: Use a switch to count, press once to count, and finally display the number of times on a four digit digital display.<\/p>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-1 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>1\u3001Teaching objectives (knowledge preparation)<\/p>\n\n\n\n<p>Know about switch sensors, understand the control and usage methods of switch sensors.<\/p>\n\n\n\n<p>Implement the counting effect using switch sensors through programming.<\/p>\n\n\n\n<p>Being able to combine real-life application scenarios and apply project devices to achieve intelligent application scenarios in daily life.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-3 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<div class=\"wp-block-group\"><div class=\"wp-block-group__inner-container is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-2 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>2\u3001Teaching tasks<\/p>\n\n\n\n<p>Build a device that can use switch sensor devices to complete counting functions.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img fetchpriority=\"high\" decoding=\"async\" width=\"744\" height=\"334\" src=\"https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-44.png\" alt=\"\" class=\"wp-image-2976\" srcset=\"https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-44.png 744w, https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-44-300x135.png 300w\" sizes=\"(max-width: 744px) 100vw, 744px\" \/><\/figure>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n<\/div><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n\n\n\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\"><\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-4 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>3\u3001Preparation of teaching environment and equipment<\/p>\n\n\n\n<p>Equipment List: Image (with label number 123456)<\/p>\n\n\n\n<p><strong>Equipment Serial Number Table<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Serial number<\/td><td>number<\/td><td>equipment<\/td><td>Specifications<\/td><td>quantity<\/td><\/tr><tr><td>1<\/td><td>&nbsp;<\/td><td>Switch<\/td><td>&nbsp;<\/td><td>1<\/td><\/tr><tr><td>2<\/td><td>&nbsp;<\/td><td>Four-digit Display<\/td><td>&nbsp;<\/td><td>1<\/td><\/tr><tr><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td>&nbsp;<\/td><td><\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p><strong>Software: <\/strong>Smart Code programming software.<\/p>\n\n\n\n<p><strong>Hardware: <\/strong>SMART Code kit: Switch\u3001Four-digit Display.<\/p>\n\n\n\n<p><strong>Other: <\/strong>Several building block devices.<\/p>\n\n\n\n<p><strong>Detailed List of Structural Components<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-table\"><table class=\"has-fixed-layout\"><tbody><tr><td>Serial number<\/td><td>number<\/td><td>equipment<\/td><td>Specifications<\/td><td>quantity<\/td><\/tr><tr><td>1<\/td><td>&nbsp;<\/td><td>3-hole beam<\/td><td>&nbsp;<\/td><td>12<\/td><\/tr><tr><td>2<\/td><td>&nbsp;<\/td><td>7-hole beam<\/td><td>&nbsp;<\/td><td>4<\/td><\/tr><tr><td>3<\/td><td>&nbsp;<\/td><td>13-hole beam<\/td><td>&nbsp;<\/td><td>4<\/td><\/tr><tr><td>4<\/td><td>&nbsp;<\/td><td>T-shaped beam<\/td><td>&nbsp;<\/td><td>4<\/td><\/tr><tr><td>5<\/td><td>&nbsp;<\/td><td>Black sales<\/td><td>&nbsp;<\/td><td>36<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p>Note: Materials required to fix a set of sensors: 6 3-hole beams, 2 7-hole beams, 2 13 hole beams, 2 T-shaped beams, and 18 black pins.<\/p>\n<\/div>\n<\/div>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-5 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>4\u3001Project Practice Process<\/p>\n<\/div>\n<\/div>\n\n\n\n<p>(Summary of Knowledge Points: 1. Components. 2. Program Modules. 3. Program Design)<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>Project video (in video format)<\/strong><\/li>\n\n\n\n<li><strong>Project Steps<\/strong><\/li>\n<\/ul>\n\n\n\n<p>1.Design and manufacture a simple counter device based on the item list.<\/p>\n\n\n\n<p>2.According to the item list, fix the four digit digital tube.<\/p>\n\n\n\n<p>3.Use SMART Code to program and control devices.<\/p>\n\n\n\n<p>Firstly, create a program entrance. The example code is as follows:<\/p>\n\n\n\n<p>Then, create the variable &#8216;times&#8217;, initialize the value of the variable&#8217; times&#8217; to 0, and initialize the four digital tubes to 0. The example code is as follows:<\/p>\n\n\n\n<p>Then, create a switch sensor event class statement, introduce the global variable times into the event class function, and use the global statement. Each press increases the variable &#8216;times&#8217; by 1, and then displays the value of the variable&#8217; time &#8216;on a four digit digital display. The example code is as follows:<\/p>\n\n\n\n<p>Finally, complete all the logic. The example code is as follows:<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"865\" height=\"240\" src=\"https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-45.png\" alt=\"\" class=\"wp-image-2977\" srcset=\"https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-45.png 865w, https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-45-300x83.png 300w, https:\/\/code.xedulab.com\/wp-content\/uploads\/2025\/02\/image-45-768x213.png 768w\" sizes=\"(max-width: 865px) 100vw, 865px\" \/><\/figure>\n\n\n\n<p>4.Optimization and improvement plan.<\/p>\n\n\n\n<p>5.Run the program to verify if the week and display match.<\/p>\n\n\n\n<p>6.Optimization and improvement plan.<\/p>\n\n\n\n<p>7.Interesting thinking: Counter, displayed in real-time on a four digit digital display.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong><strong>Reflection and discussion:<\/strong>Can multiple counting function be achieved?<\/strong>\n<ul class=\"wp-block-list\">\n<li>Reflection and exploration:<\/li>\n\n\n\n<li>Question 1:<\/li>\n\n\n\n<li>Question 2:<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<div class=\"wp-block-columns is-layout-flex wp-container-corecolumns-is-layout-6 wp-block-columns-is-layout-flex\">\n<div class=\"wp-block-column is-layout-flow wp-block-column-is-layout-flow\" style=\"flex-basis:100%\">\n<p>5\u3001Extension and Expansion<\/p>\n<\/div>\n<\/div>\n\n\n\n<p>Reflection and exploration:<\/p>\n\n\n\n<p>Question 1:<\/p>\n\n\n\n<p>Question 2:<\/p>\n<button class=\"simplefavorite-button has-count preset\" data-postid=\"592\" data-siteid=\"1\" data-groupid=\"1\" data-favoritecount=\"0\" style=\"box-shadow:none;-webkit-box-shadow:none;-moz-box-shadow:none;background-color:#ffffff;border-color:#ffffff;color:#686868;\"><i class=\"sf-icon-favorite\" style=\"color:#686868;\"><\/i>\u6536\u85cf<span class=\"simplefavorite-button-count\" style=\"\">0<\/span><\/button>","protected":false},"excerpt":{"rendered":"<p>\u6536\u85cf0 Introduction: Use a switch to count, press once to &#8230;<\/p>\n","protected":false},"author":16,"featured_media":2979,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[85,84],"tags":[],"class_list":["post-592","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-3d-printing","category-art"],"_links":{"self":[{"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/posts\/592","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/users\/16"}],"replies":[{"embeddable":true,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/comments?post=592"}],"version-history":[{"count":3,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/posts\/592\/revisions"}],"predecessor-version":[{"id":2980,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/posts\/592\/revisions\/2980"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/media\/2979"}],"wp:attachment":[{"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/media?parent=592"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/categories?post=592"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code.xedulab.com\/index.php\/wp-json\/wp\/v2\/tags?post=592"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}