Microbit2
Jump to navigation
Jump to search
If Statement
Why is the temperature so complicated?
What is happening?
Temperature is a number. To get something done we need to tell the microcontroller some "program", like:
do something if the temperature gets below 10 degrees.
This "if" is one of the most important programming principles.
If something is true do THIS. if that something is NOT true, do THAT.
In fact the button input is also like an IF statement:
if the button is pushed, then.....
So we need an IF: - from "LOGIC"
Then we need a comparison from LOGIC
Then we need temperature form INPUT
We need to puzzle this indie each other, the shapes are helping:
and we get this - inside the "FOREVER"