#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
2 Answers 2
#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 .
answered Oct 28, 2020 at 18:46
-
4what is next? The "Bare Minimum" example without loop()?2020年10月28日 19:59:56 +00:00Commented Oct 28, 2020 at 19:59
-
1True but just go a little easy in the newbiexbox gamer– xbox gamer2020年10月28日 21:30:00 +00:00Commented Oct 28, 2020 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– DataFiddler2020年10月28日 21:52:45 +00:00Commented Oct 28, 2020 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 similarxbox gamer– xbox gamer2020年10月28日 22:05:01 +00:00Commented Oct 28, 2020 at 22:05
by increasing the delay value, you can visualize it better.
{
digitalWrite(13, HIGH);
delay(2000);
digitalWrite(13, LOW);
delay(1000);
}
lang-cpp
delay()
expects the interval in milliseconds. Please do so the enxt time.