EngineersGarage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise
You are here: Home / Topics / arduino LED blink without delay

arduino LED blink without delay

|

Microcontroller › Arduino › arduino LED blink without delay

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 11 months ago by Prabakaran P M.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • September 12, 2015 at 2:04 am #3979
    JAPAN HARESHBHAI PATEL
    Participant

    hello,

    i have tried new code…using without delay…i think this is my code is right but still LED not blinking….plz help me to remove bug in my this code..

    #blink LED with 2 sec delay

    _________________________________________________________________

    int led=13,ledstate;

    int previous=0;

    int interval=2000;

    void setup()

    {

    pinMode(led,,OUTPUT);

    }

     

    void loop

    {

    int current=millis();

    if(current – previous>=interval)

    {

    previous=current;

    digitalWrite(led,HIGH);

    }

    else

    {

    digitalWrite(led,LOW);

    }}}

    }

     

    September 14, 2015 at 5:13 am #13286
    Prabakaran P M
    Participant
    Hi, You can use this code,
     
    int led=13,ledstate;
     
    int previous=0;
     
    int interval=2000;
    boolean toggle = false;
     
    void setup()
     
    {
     
    pinMode(led,OUTPUT);
     
    }
     
    void loop ()
     
    {
     
    int current=millis();
     
    if(current – previous>=interval)
     
    {
     
    previous=current;
     
      toggle = !toggle;
      digitalWrite(13,toggle);
     
    }
    }
     
  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Log In

RSS feed: Recent Posts Recent Posts

  • Advice for an ESP32 Soil Tensiometer project with 5V sensors September 4, 2026
  • Control diesel fuel injector September 3, 2026
  • Smoothing out Resistive Power Draw with PWM September 3, 2026
  • Deacy Amp circuit diagram? September 2, 2026
  • Need to control diesel fuel injector using microcontroller September 1, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 Arrowfly LLC. All Rights Reserved. The material on this site may not be reproduced, distributed, transmitted, cached or otherwise used, except with the prior written permission of Arrowfly
Privacy Policy | Advertising

Search Engineers Garage

  • Engineers Garage Main Site
  • Visit our active EE Forums
    • EDABoard.com
    • Electro-Tech-Online
  • Projects & Tutorials
    • Circuits
    • Electronic Projects
    • Tutorials
    • Components
  • Digi-Key Store
    • Cables, Wires
    • Connectors, Interconnect
    • Discrete
    • Electromechanical
    • Embedded Computers
    • Enclosures, Hardware, Office
    • Integrated Circuits (ICs)
    • Isolators
    • LED/Optoelectronics
    • Passive
    • Power, Circuit Protection
    • Programmers
    • RF, Wireless
    • Semiconductors
    • Sensors, Transducers
    • Test Products
    • Tools
  • Advertise