Microbit2

From Interaction Station Wiki
Revision as of 17:17, 9 April 2020 by Beam (talk | contribs) (Created page with " == 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 "prog...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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"

Mb30.png

Then we need a comparison from LOGIC

Mb31.png

Then we need temperature form INPUT

Mb32.png

We need to puzzle this indie each other, the shapes are helping:

Mb33.png

and we get this - inside the "FOREVER"

Mb26.png