Arduino boards have I/Os (Input/Output) that can either receive or transmit signals. One of its basic functions is digital input/output. It can be programmed to output digital signals that can be used drive devices, such as an LED . To drive an LED, you will have to add a resistor to regulate the current to the LED. The digital output is about 3V (5V or a little less for 5V board), and for an LED the forward voltage is about 2V. What is left (1V) divided by the resistor sets the current. Current is typically 10 to 20mA. Driving an LED Below is an example code for alternating LEDs on Arduino Pro Micro Board. It uses pins 2, 3, 4, and 5 as digital outputs. My 11 year old son helped out in the programming. :) void setup() { // initialize digital pins 2, 3, 4, and 5 as outputs. pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(2, LOW); // turn
Practical electronics circuit designs, tips, and tutorials for hobbyists and professionals alike.