Mixly-智能楼道灯

mac2025-04-02  6

Mixly-智能楼道灯

声控灯:

void setup(){ Serial.begin(9600); pinMode(8, OUTPUT); } void loop(){ Serial.println(analogRead(A3)); if (analogRead(A3) <= 100) { digitalWrite(8,HIGH); } else { digitalWrite(8,LOW); } }

人体红外检测灯:

void setup(){ pinMode(6, INPUT); Serial.begin(9600); pinMode(8, OUTPUT); } void loop(){ Serial.println(digitalRead(6)); if (digitalRead(6)) { digitalWrite(8,HIGH); } else { digitalWrite(8,LOW); } }

最新回复(0)