Project introduction:
Timers we use every day,It can also be usedMicrobitproduced. The following will teach how to program, while makingThe finished product is that when you press A, the timing will start; when you press B, the timing will stop, and then pressing A+B at the same time will show how much time has passed.
List of materials:
- Microbit
Instructions
Step
programming steps
1) Enterwww.makecode.microbit.org's website
2) Create a new project named Timer
3) The part where the timing starts:
-In "Input", find the "When button A is pressed" block and pull it out
-Create a variable named "start"
-existUnder the variable, look for "Variable Start is set to 0", and then pull out this block
-Then pull out the "running time (ms)" in the input more and put it in 0
- Add the "display text" building block, hit S to indicate Start
4) The part where the timing ends:
-In "Input", find the "When button A is pressed" block and pull it out, then change "A" to "B"
-Create a variable named "end"
-existUnder the variable, look for "the variable end is set to 0", and then pull out the block
-Then pull out the "running time (ms)" in the input more and put it in 0
- Add the "display text" building block, hit E to end End
5)the part showing the time
-In "input", find the block of "when button A is pressed" and pull it out, then change "A" to "A+B"
-Create a variable named "time"
-pull out "variabletimeset as0” The building blocks, and then the coefficients are pulled into the surface "0 - 0" release0into the face
-The formula will be "endreducestart"to calculate a time difference
-Add the "display number" building block, pay attention to dividing the number by 1000 to know how many seconds
6) After completing the programming, you can test it on the simulator on the left/download to Microbit
Comments
Projects you might be interested in
這隻漂流船叫做坦克漂流船,為什麼他叫坦克飄流船呢?因為他的外型看起來很像一輛坦克,所以我為他命名為坦克漂流船。
There are no reviews yet.