mBlock Adding Control

Students will:

  • use a button to control when a light sequence stops and starts

I will use Scratch mode to immediately show the boolean state of a read digital pin block. I have connected the push button into pin 3. When I double click on the block the voltage is zero and it displays false.  When the button is down and I double click on the block it displays true. Using this we can use an if statement to start and stop our light sequence.

 

 

 

The code is below. I can use the say command in Scratch mode to let me see the value of digital pin 3.  I plan on asking the kids to try the code out then describe what is happening block by block in a journal entry then give them a short related assignment.

 

 

 

 

 

, ,

Comments are closed.