The Arduino has an LED built right into the hardware that you can control. This tutorial shows you how to make that LED blink on and off. It introduces some very common nodes, like the Output, Switch, and Timer nodes.

View Comments (0)

The Arduino has an LED in it that you can control, in this tutorial we’ll see how to make it blink. All you need is your Ardunio connected to your computer with the USB cable.

Open up Embrio and make a new project, I’ll call this one Blink Built In LED. The new project starts with an agent that is already open for editing. Right click somewhere on the editor and add an Analog / Digital output node from the Input Output menu. From the pin type drop down select Digital, then select Pin 13, which is the pin that the built in LED is connected to.

Now connect to your Arduino using the communication panel in the bottom left of the screen. First make sure you have the correct Arduino model selected, then make sure you have the correct com port, then click the connect button. The Arduino logo will pop up while Embrio uses the Arduino software to upload a connection program. When it’s done, you’ll see a “good connection” message in the serial communication area. If there’s a problem, like you picked the wrong ardunio or port, the error will be shown on the bottom right of the screen.

Now that Embrio is connected to your Arduino, you can click and drag on the Input Activation of the output node to turn on and off the LED. When the activation value goes above .5 the LED turns on, and turns back off when the activation is below .5. This is nice to see how it works, but I want the LED to turn on and off by itself. Next I add a Switch node from the flow control menu, and attach its output activation to the output node. Play with the switch node to see how it works by pressing on the input trigger buttons. When the switch is on it outputs an activation of 1, and 0 when its off. Clicking on the toggle switch turns the LED on and off.

I want the toggle trigger to repeatedly fire to make the LED blink. To do this, I add a Timer node from the Flow Control menu. When you click the Start trigger, the output animates from 0 to 1 over 1 second. You can change how many seconds the timer takes by setting the Max Seconds value, but I’ll leave it at one. Notice that when the timer finishes, the Finished output trigger fires. I want the timer to run again after it finishes, so I’ll drag a connection from the Finished trigger to the Start input trigger. When the timer finishes, I also want it to toggle the switch, so I also connect the Finished trigger to the Toggle input on the switch. Now the LED is blinking!

I manually started this timer running. I want it to start by itself when the program starts, so I add a startup trigger node from the Flow Control menu and connect it to the Start input on the trigger. Now the program is done, so I click on the Compile and Upload button to upload the finished program which now runs on the Arduino without a connection to Embrio.

View Comments (0)