• Download
  • Tutorials
  • Buy
  • Library
  • Docs
  • Forum
  • Log In

This tutorial shows you how to use an Output node and a repeating Timer node with an end behavior of "return" to make an LED fade on and off.

Download Project: Fade LED.zip

View Comments (0)

In this tutorial I’ll show how to make an LED fade on and off. You’ll need an LED and a resistor between 220 and 1 thousand Ohms. I’m using a 270 ohm one.

I’m starting with a bread board that has the ground and voltage channels connected to an Arduino Nano. The LED has 2 legs. Plug the shorter leg into the Ground channel, and the longer one into one of the terminal strips. Next add the resistor by sticking one leg into a hole in the same terminal strip as the LED, and the other into another terminal strip. The notch in the center of the bread board separates the two sides, so I’m going to plug into the matching strip on the other side of the breadboard because I like the way it looks. Now take a jumper wire and connect that leg of the resistor to pin D3 on the Arduino.

I’ve got a new project in Embrio. On the default agent I add an Analog / Digital output node. I’m going to leave the default settings of pin type Analog and pin 3. Notice that you can’t use all of the pins for analog outputs, just the ones in the drop down. I connect to the Arduino, and after the connection program uploads I can control the brightness of the LED by dragging on the activation. I want it to animate up and down, so I use a Timer node from the Flow Control menu. Like in the blink example, I want the timer to repeat, so I connect the finished output to the start input, and I want it to start when the program starts, so I connect a startup trigger from the Flow Control menu. Connect the timer’s output to the output node and now the LED is fading from off to on, then jumps back down to off. I want it to fade in and out, so I change the end behavior on the timer to return.

View Comments (0)