Tuesday, May 24, 2022

EXP 6 CREATE A SMARTLIGHT USING RASPBERRY PI AND ARDUINO UNO

 



const int ledpin = 13; // ledpin and lightpin are not changed throughout the process const int lightpin = A2; const int LIGHT = 10; // sets LIGHT value for light sensor void setup() { Serial.begin(9600); pinMode(ledpin, OUTPUT); pinMode(lightpin, INPUT); } void loop() { int lightsens = analogRead(lightpin); // reads analog data from light sensor if (lightsens < LIGHT) { digitalWrite(ledpin, HIGH); //turns led on delay(1500); } else { digitalWrite(ledpin, LOW); } }


No comments:

Post a Comment

Control led light using remote

 // Include IR Remote Library by Ken Shirriff #include <IRremote.h> // Define sensor pin const int RECV_PIN = 4; // Define LED pin #de...