mirror of
https://bitbucket.org/myhomie/mycorerepository.git
synced 2025-12-06 17:51:20 +00:00
29 lines
394 B
C++
29 lines
394 B
C++
|
|
int motion = 9;
|
|
int motionLed = 4;
|
|
int Relay = 7;
|
|
|
|
void setup() {
|
|
|
|
pinMode(motion, INPUT);
|
|
pinMode(motionLed, OUTPUT);
|
|
pinMode(Relay, OUTPUT);
|
|
}
|
|
|
|
void loop()
|
|
{
|
|
|
|
long sensor = digitalRead(motion);
|
|
|
|
if(sensor == HIGH){
|
|
digitalWrite (motionLed, HIGH);
|
|
digitalWrite(Relay, HIGH);
|
|
}
|
|
else
|
|
{
|
|
digitalWrite (motionLed, LOW);
|
|
digitalWrite(Relay, LOW);
|
|
}
|
|
|
|
}
|