
Code to Note
Let’s take a look at the code blocks in this experiment.
If you are having a hard time viewing this code, click on the image above to get a better look!
Set Pull Pin
When you start your micro:bit, some pins can be set to be naturally on or naturally off. The
set
pull
pin
block allows you to set an initial state of a pin by selecting a pin and then its pull state, which
is
UP
,
DOWN
or
NONE
.
Set Pin to Emit Event
Just like the button event in Experiment 4 there are events that you can read. But first, you have to
set a pin to emit an event. You use the
set
pin
to
emit
event
block to create a type of event for a
specific pin to emit or send out when it reaches that state. As an example, we set P16 to emit
an
EDGE
event, which means that it changed from HIGH to LOW or LOW to HIGH.