Arduino: Controlling the Onboard LED: Part 2

Published

Introduction: Arduino: Controlling the Onboard LED: Part 2

About: My hobbies are electronics and photography. I have an Arduino which I like to program, and I make stop motion videos with my camera. I also have a great interest in DIY.

In the last instructable of controlling the onboard LED, I showed you haw to turn the light on and off. In this one, I'll show you how to make it do it automatically.

Step 1: Materials

Step 2: LED

Plug the Arduino and open the Arduino IDE. The LED should be blinking if the board is brand new. Actually, the program the board is using now is the program we are going to be studying.

Type, copy, or download.

void setup() {
pinMode(LED_BUILTIN, OUTPUT); } void loop() { digitalWrite(LED_BUILTIN, HIGH); delay(1000); digitalWrite(LED_BUILTIN, LOW); delay(1000); }

Upload the program and the LED should start blinking. 1000 means 1 second in milliseconds. So the light blinks every one second. Now change both 1000's to 500. Upload the program. The LED should now be blinking twice as fast. You can change these to however fast you like.


Congratulations! You now know how to blink an LED using delay.

Share

    Recommendations

    • Planter Challenge

      Planter Challenge
    • Make it Move Contest

      Make it Move Contest
    • Woodworking Contest

      Woodworking Contest
    user

    We have a be nice policy.
    Please be positive and constructive.

    Tips

    Questions

    Comments