Ashu Mhr Technical
Published

Automatic Room Light Controller

This is a very advantageous yet easy to make project. We call it " Automatic Room Light Controller ".

IntermediateFull instructions provided1,807
Automatic Room Light Controller

Story

Read more

Schematics

gerber_pcb_auto_matic_light_2022-04-08_8RIBmbwp2x.zip

how-to-order-pcb_79LASLKGru.txt

Code

Arduino Code

Arduino
/*
  code started
  #define ir pin = D2;
  #define led pin = D8;
  code created by technical ideas yt https://youtube.com/c/TechnicalidEas07
 */
int pbuttonpin=2;
int led=5;
int val=0;
int lighton=0;
int pushed=0;
void setup() {
  // put your setup code here, to run once:
pinMode(pbuttonpin,INPUT_PULLUP);
pinMode(led,OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
val=digitalRead(pbuttonpin);
if(val==HIGH && lighton==LOW)
{
pushed=1-pushed;
delay(100);
}
lighton=val;
if(pushed==HIGH)
{
  digitalWrite(led,LOW);
}else
{
  digitalWrite(led,HIGH);
}}

Credits

Ashu Mhr Technical

Ashu Mhr Technical

13 projects • 2 followers

Comments