arduino板红外控制电机风扇转动,这个程序是有什么错误吗?为什么风扇转几秒就不转了?
#include <IRremote.h> const int input1 = 5; const int input2 = 6; const int irReceiverPin =7; IRrecv irrecv(irReceiverPin); decode_results results; void setup() { pinMode(input1,OUTPUT); pinMode(input2,OUTPUT); Serial.begin(9600); irrecv.enableIRIn(); } void loop() { if (irrecv.decode(&results)) { Serial.print("irCode: "); Serial.print(results.value, HEX); Serial.print(", bits: "); Serial.println(results.bits); irrecv.resume(); } delay(600); if(results.value == 0xFFA25D) { digitalWrite(input1,HIGH); digitalWrite(input2,LOW); } else { digitalWrite(input1,LOW); digitalWrite(input2,LOW);
} }
|