Class Notes-Getting Started

Blink using mBlock and an Arduino

Pin 13 has an LED incorporated into the board. So we can use that to see if everything is working.

We will start in Scratch mode.

Try these blocks out.

This is similar to what we have done with Scratch and the Hummingbird. We are setting pin 13 high or 5 volts for one second then low or 0 volts for 1 second and this will make the LED blink.
If disconnected from the USB connection the program will stop. If we do this we will need to go back to our serial port and reconnect to work again in Scratch mode.

We can also use Arduino mode. To do this we will go to the edit menu and switch to Arduino mode


You now have the option to upload this code to the arduino.


This uploads the code to the board and once again it will start blinking.

The code resides on the board so if you disconnect it from the USB connection providing power it stops. If you give the board power via battery, power plug or USB the LED will start blinking again.

When we deselect Arduino mode we will be back in Scratch mode but need to reselect our Serial Port and upgrade firmware to use it in Scratch mode. Once this is done you can modify your blocks and double click on them to check out the changes.

This is the block I used in Scratch Mode to make the LED stay on for 5 seconds instead of one.

Next step will be some soldering and adding a few LED’s to the Arduino.

, ,

Comments are closed.