top of page
What you will learn: How to build a reaction game with Scratch 2.0 and your outputs, using variables
What you will need:
1 x LED
1x 220 ohm resistor
1x male to male jumper
What you will do
Wire up your breadboard
We will be using GPIO 16
Next lets pull in some blocks. A key to start the game and a welcome message to the user then some instructions. Along with a "set gpio" block
To get this block
click "More Blocks,
then click "Add and Extension"
then click this and ok
OK now we want the number to be random so the user can never guess the pattern of the LED. Also we want to turn on the LED that is in GPIO 16 (output high means on)
here
Don't forget to check timer!!!
this block can be found in operators
Now we want to reset the timer to 0 and when the space key is pressed our "variable" time will appear on the screen
reset timer
found here
input block
We want to display the time so create a variable called 'time' and place the 'timer' block at the end
click here and call it "time"
check this box
this is in Sensing
Now add two more say blocks at the bottom and you are done, awesome. Try it out!
Taking it further
Can you find a way to use the if else block to make the game more customized?
bottom of page