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, 7 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 Recent Posts

  • isolating S-params in of PCB board without connectors April 11, 2026
  • Assistance locating a 'trail' camera gadget, please ? April 10, 2026
  • Raise your hand if your car had one of these: April 10, 2026
  • Some opamp advice please April 10, 2026
  • Voltage comparator circuit verification April 10, 2026

Stay Up To Date

Newsletter Signup
EngineersGarage

Copyright © 2026 WTWH Media 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 WTWH Media
Privacy Policy | Advertising | About Us

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