0
#include <Arduino.h>

void setup()
 {
  pinMode(13, OUTPUT);
 }
void loop()
{
 digitalWrite(13, HIGH);
 delay(1);
 digitalWrite(13, LOW);
 delay(1);
}

I am trying to make an led glow for one second to glow and then go off but nothing happens

  • 1
    how did produce a wrong version of the most basic Arduino example? arduino.cc/en/Tutorial/BuiltInExamples/Blink – Juraj Oct 29 at 6:35
  • 1
    Your first step when facing such a problem is to read the documentation. You have 3 functions in your code, which as read in a short time, less than 5 minutes. You would have found the delay() expects the interval in milliseconds. Please do so the enxt time. – the busybee Oct 29 at 14:01
3
#include <Arduino.h>

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

The problem with your code is that the delay function works in milliseconds and not seconds . 1sec = 1000ms .

| improve this answer | |
  • 1
    thanks it is working now – arduino Oct 28 at 18:49
  • 4
    what is next? The "Bare Minimum" example without loop()? – Juraj Oct 28 at 19:59
  • 1
    True but just go a little easy in the newbie – xbox gamer Oct 28 at 21:30
  • @Juraj: The Bare Minimum Blink (arduino.cc/en/Guide/ArduinoUno#open-your-first-sketch ) works without the line #include <Arduino.h> – DataFiddler Oct 28 at 21:52
  • I use platform io for programing so in that it is important to include arduino.h maybe the person who asked is also using platform io or something similar – xbox gamer Oct 28 at 22:05
1

by increasing the delay value, you can visualize it better.

{

 digitalWrite(13, HIGH);

 delay(2000);

 digitalWrite(13, LOW);

 delay(1000);

}
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.