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

xbox gamer
4233 silver badges14 bronze badges
asked Oct 28, 2020 at 18:43
2
  • 1
    how did produce a wrong version of the most basic Arduino example? arduino.cc/en/Tutorial/BuiltInExamples/Blink Commented Oct 29, 2020 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. Commented Oct 29, 2020 at 14:01

2 Answers 2

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 .

answered Oct 28, 2020 at 18:46
4
  • 4
    what is next? The "Bare Minimum" example without loop()? Commented Oct 28, 2020 at 19:59
  • 1
    True but just go a little easy in the newbie Commented 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> Commented 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 similar Commented Oct 28, 2020 at 22:05
1

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

{
 digitalWrite(13, HIGH);
 delay(2000);
 digitalWrite(13, LOW);
 delay(1000);
}
xbox gamer
4233 silver badges14 bronze badges
answered Oct 28, 2020 at 23:00

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.