This project bases on PJ001 + PJ002, uses Micro:bit pin 0 with external button as digital input, and pin 1 with external LED as digital output, programmed by MakeCode blocks. By this project, you get a good picture of digital signals as input and output. Goals:
Digital signals and input/output basic understanding
LED as the typical simple digital output-er, button as the typical simple digital input-er
Read digital signal from Micro:bit pin as input
Write digital signal to Micro:bit pin as output
Hardware: LED, Tactile button, and wiring
Software: if-else logic condition, comparison judgement
START A BIT > Projects Library > This page
Here is an example of the successful result done by our student. No video.
It's basically a combination of PJ001: External LED with Micro:bit and PJ002: External button with Micro:bit.
Use Micro:bit pin 0 as digital signal input from external button
Use Micro:bit pin 1 as digital signal output to drive external LED
Use Micro:bit built-in A/B as digital signal input
Press external button to light up the external LED, and
Press built-in button A or B to turn off the external LED
[x] Simple: 30-60 minutes
[ ] Moderate: 1-2 hours
[ ] Challenging: more than 2 hours
The estimation bases on average situation without unexpected troubleshooting, assuming that the student meets prerequisites. It only indicates rough time needed to complete this project, but not about technical difficulty, not covering discussion and sharing time. Here is a possible breakdown:
5-10 minutes: Understand requirement and solution, collect materials
20-25 minutes: Hardware setup and wiring
20-25 minutes: Programming
1 minutes: Download and test
One should have prior knowledge
Micro:bit V2 board, Micro:bit pin breakout board, Breadboard: Know what they are, better to have prior experience using them
MakeCode by Microsoft, the programming tool, better to have prior experience using it with Micro:bit
LED basic what/how: Should be able to identify and connect the legs correctly
Tactile switch/button basic what/how : Should be able to identify and connect the legs correctly
Resistor basic what/how: Just need to know what it is, better to know why we need it here, no need to know how to read the color rings
Better to have successfully completed
1x Micro:bit V2 board , with USB cable
1x breadboard
1x LED, random color
1x 220 Ω resistor
1x 10 kΩ resistor
Some jumping wires
This is what you need to build in a simplified view.
Use the micro:bit pin breakout and breadboard to connect the components, you don’t need to use the exact holes in the breadboard as others, as long as the wiring path is correct.
LED's 2 lead are polarized! Recognized the difference, wire the "-" leg towards GND.
Learn more: LED basic what/how.
To get input of digital signal from a specific pin
Advanced -> Pins ->
To output a digital signal to a specific pin
Advanced -> Pins ->
To link the logic, you need a if-else block and logic judgement block as well
Logic -> Conditions ->
Logic -> Comparison->
Press external button to light up the external LED, and
Press built-in button A or B to turn off the external LED
Tip: If you don't know what to do with the "if-else" and "0=0" blocks...This is the final look after putting those logical blocks together
This optional part covers further competence development, in terms of testing, troubleshooting, analysis, documentation, flow chart diagrams practices, etc.
Stand in front of the class, share with your group what you have made, please cover important points
Tell what it is your product
Demonstrate how it works
Explain how it works
Share with your group about
What troubles you met
How you analyze
How you get help
How you solve it
What you have learnt
Use your own way to visualize how the hardware components are connected by a free style drawing.
Visualize clearly the wiring path, mark clearly the pins and end points
So that your friends can follow this drawing to correctly reproduce the hardware setup
Any kind of children style drawing is OK! Here are some examples.
Use your own way to visualize how the programming controlling logic is done, by a free style drawing, so that your friends can follow this flow-chart to reproduce the programming.
You might be interested to know what is "flow chart", click to learn more, but so far, it's not needed to be that serious, just draw something that can help you explain to your friends how the programming is made.
What is the possible value of a digital signal?
When pressing the button, what is input to the Micro:bit?
These questions are out of scope for this project, but great to think about them, ask and discuss if you have enough effort
Why do we need a resistor with the button? What if we remove the resistor?
How to read the resistor value by the color rings?
If you get a quick done, do you dare to take further challenges? Those challenging points are independent, not related to one another
Draw the flow chart of the program, this project is good for this practice.
Keep the same hardware setup, try PJ004: Use 3 buttons to light up external LED with compound conditions for if-else
Requirement: