How To Turn On A Single LED Using An Arduino

To turn on a single LED using an Arduino. The components needed: Arduino board (e.g., Arduino Uno) LED (any color) Resistor (220-330 ohms) Breadboard Jumper wires Follow these steps“ Step 1. Connect the longer leg of the LED (positive terminal / anode) to digital pin 13 on the Arduino. Use a jumper wire and insert one end into pin 13 and the other end into any hole in the breadboard. Step 2. Connect the shorter leg of the LED (negative terminal / cathode) to the resistor. Insert one end of the resistor into the same row as the LED’s shorter leg. Step 3. Connect the other end of the resistor to the GND (ground) pin on the Arduino. Use a jumper wire to connect the resistor to any GND pin on the Arduino. Step 4. Ensure your Arduino is connected to your computer via a USB cable. Step 5. Open the Arduino IDE (Integrated Development Environment) on your computer. (The software you installed) Step 6. In the Arduino IDE, select the appropriate board and port from the “Tools“ menu. Code writing in the Arduino IDE (the software on your computer. void setup() { pinMode(10, OUTPUT); // Set pin 10 as an output } void loop() { digitalWrite(10, HIGH); // Turn on the LED delay(1000); // Wait for 1 second digitalWrite(10, LOW); // Turn off the LED delay(1000); // Wait for 1 second } Step 8. Please make sure you write the codes well because the little mistake you will make will be resulted in an error. Step 9. Click on the “Upload“ button in the Arduino IDE to upload the code to your Arduino board. (On your top left on the app) Step 10. The LED connected to pin 13 should now turn on and off repeatedly, with a 1-second delay between each state change. NB: You can change the timer (1-second to either 2 or 3 seconds). That is the delay 1000 - 2000 - 3000 Well done for attempting to code.
Back to Top