Anti sleep alarm

Arduino code:
#define SENSE A0 

void setup()
{
pinMode(SENSE, INPUT);
pinMode(2, OUTPUT);


pinMode(LED_BUILTIN, OUTPUT);
}
void loop()
{
if(digitalRead(SENSE))
{
 digitalWrite(LED_BUILTIN, LOW);
 pinMode(2, LOW);
}
else
{
  delay (2000);
  if(digitalRead(SENSE))
  {
 digitalWrite(LED_BUILTIN, LOW);
 pinMode(2, LOW);
}
  else
  digitalWrite(LED_BUILTIN, HIGH);  
   pinMode(2, HIGH);
  }
}

Post a Comment

17 Comments

  1. Sir can I get this product ready made

    ReplyDelete
  2. Sir which code you have used in this project

    ReplyDelete
    Replies
    1. This comment has been removed by the author.

      Delete
  3. Sir what is LED-BUILTIN in this program

    ReplyDelete
    Replies
    1. Led builtin is D13 of nano connected internally to LED

      Delete
  4. Sir ir sensor sense nei kr rha h continue weep kr rha h pls diagram send kro

    ReplyDelete
  5. Please provide authentic code. Which you have uploaded

    ReplyDelete
  6. Program upload nahi ho raha hai kya karan ho sakta hai

    ReplyDelete