𝐇𝐨𝐰 𝐓𝐨 𝐌𝐚𝐤𝐞 𝐒𝐦𝐚𝐫𝐭 𝐋𝐢𝐠𝐡𝐭
Code :-
// Code Started// This Code Created By Technical idEas(YT)// Smart Light Using By PIR Sensor
int pbuttonpin=4; int led=7; 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); } delay(100); }
Circuit Diagram :-
If You have any Problem, can you tell me on Instagram
Instagram ID :- Technicalideas07
Link :- https://www.instagram.com/technical_ideas_07/
Subscribe Now :- https://youtube.com/channel/UCCJyR_wnt3SxhErsSUP9Wrw
Comments
Post a Comment