我正在制作一个涉及 RTC 和伺服电机的项目,以便它只在特定时间打开。循环中的一个片段是:
void loop() {
DateTime now = rtc.now();
if (DateTime == 19:10) {
//Some stuff
} else {
return();
}
}
我的错误是:
Arduino: 1.6.8 (Windows 10), Board: "Arduino/Genuino Uno"
C:\Users\User\Documents\Arduino\Servo_motor\Servo_motor.ino: In function 'void loop()':
Servo_motor:36: error: expected primary-expression before '==' token
if (DateTime == 19:10) {
^
Servo_motor:36: error: expected ')' before ':' token
if (DateTime == 19:10) {
^
Servo_motor:45: error: expected primary-expression before '}' token
}
^
Servo_motor:45: error: return-statement with a value, in function returning 'void' [-fpermissive]
Servo_motor:45: error: expected ';' before '}' token
Multiple libraries were found for "RTClib.h"
Used: C:\Program Files (x86)\Arduino\libraries\RTClib
Not used: C:\Users\User\Documents\Arduino\libraries\arduino_786051
exit status 1
expected primary-expression before '==' token
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.
我真的很困惑。有人可以帮忙吗?