Stap 2, Blink
Before learning how to walk, learn how to blink a LED!
It is tradition in the world of robot programming to start by making a LED blink on and off, so this is what we will start with.
Before we start the programming, we need to make sure the mBlock environment is set up correctly.
When set up correctly, the environment should look like this:
Windows:
Mac:
Let’s start by assembling the blocks in such a way to make a LED blink on and off.
First click on the section Robots from the scripts menu. Find the block called Arduino Program and drag into the grey script area. This block is the starting point of any script for the Simple Walker.


If the LED does not blink or you got some error during the upload it might be the case that you didn’t select the right COM port. Go to Connect -> Serial Port, select a different COM port and try to upload again.
Wat did you just do?
The blocks that you have dragged into one script represent simple operations. The forever block tells the robot that some behavior should be repeated indefinitely. What will be repeated? Those blocks that you put inside of the forever block. In this case you tell the Simple Walker to turn the LED connected to pin 13 on, then wait for a second, and then turn it off again. After this wait another second. This process is repeated forever.
Puzzles:
See if you can figure out some variations on this program yourself:
Puzzle 1. Faster
Change the sketch in such a way that the LED will blink twice as fast.
Puzzle 2. Twist
Change the sketch in such a way that the LED will stay on for only 0.1 seconds and off for 1 second.
Puzzle 3. SOS
What if the Simple Walker needs help? It can not talk, but it can use the LED to communicate. Create a sketch that will send the SOS signal using the LED. The Morse code for SOS is short-short-short-long-long-long-short-short-short.