7233| 7
|
萌新问题:人体红外感应模块 |
#include <Servo.h> int sensorPin = 2; Servo myservo1; Servo myservo2; int sensorState = 0; void setup() { myservo1.attach(10); myservo2.attach(11); pinMode(sensorPin, INPUT); } void loop() { sensorState = digitalRead(sensorPin); if (sensorState == HIGH) { myservo1.write(90); myservo2.write(0); } else { myservo1.write(0); myservo2.write(90); } } |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed