在使用Arduino设计电子时钟时,程序运行出错,具体问题如下:请求各位吧神帮忙解答,谢谢!
1.打开Arduino-----运行示例文件(文件---示例---DS1307RTC---Settime),然后就是这样的情况!
2.错误提示:
In file included from C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino:3:0:
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:19:22: error: 'tmElements_t' has not been declared
static bool read(tmElements_t &tm);
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:20:23: error: 'tmElements_t' has not been declared
static bool write(tmElements_t &tm);
^
SetTime:10: error: 'tmElements_t' does not name a type
tmElements_t tm;
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'void setup()':
SetTime:20: error: expected primary-expression before ')' token
if (RTC.write(tm)) {
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'bool getTime(const char*)':
SetTime:53: error: expected unqualified-id before '.' token
tm.Hour = Hour;
^
SetTime:54: error: expected unqualified-id before '.' token
tm.Minute = Min;
^
SetTime:55: error: expected unqualified-id before '.' token
tm.Second = Sec;
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'bool getDate(const char*)':
SetTime:70: error: expected unqualified-id before '.' token
tm.Day = Day;
^
SetTime:71: error: expected unqualified-id before '.' token
tm.Month = monthIndex + 1;
^
SetTime:72: error: expected unqualified-id before '.' token
tm.Year = CalendarYrToTm(Year);
^
使用 1.0 版本的库 Wire 在文件夹: F:\arduino\5-开发软件\官方标准开发软件arduino-1.0.5-windows\Arduino\hardware\arduino\avr\libraries\Wire
使用 1.4 版本的库 DS1307RTC 在文件夹: C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC
exit status 1
'tmElements_t' does not name a type
3.
1.打开Arduino-----运行示例文件(文件---示例---DS1307RTC---Settime),然后就是这样的情况!
2.错误提示:
In file included from C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino:3:0:
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:19:22: error: 'tmElements_t' has not been declared
static bool read(tmElements_t &tm);
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC/DS1307RTC.h:20:23: error: 'tmElements_t' has not been declared
static bool write(tmElements_t &tm);
^
SetTime:10: error: 'tmElements_t' does not name a type
tmElements_t tm;
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'void setup()':
SetTime:20: error: expected primary-expression before ')' token
if (RTC.write(tm)) {
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'bool getTime(const char*)':
SetTime:53: error: expected unqualified-id before '.' token
tm.Hour = Hour;
^
SetTime:54: error: expected unqualified-id before '.' token
tm.Minute = Min;
^
SetTime:55: error: expected unqualified-id before '.' token
tm.Second = Sec;
^
C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC\examples\SetTime\SetTime.ino: In function 'bool getDate(const char*)':
SetTime:70: error: expected unqualified-id before '.' token
tm.Day = Day;
^
SetTime:71: error: expected unqualified-id before '.' token
tm.Month = monthIndex + 1;
^
SetTime:72: error: expected unqualified-id before '.' token
tm.Year = CalendarYrToTm(Year);
^
使用 1.0 版本的库 Wire 在文件夹: F:\arduino\5-开发软件\官方标准开发软件arduino-1.0.5-windows\Arduino\hardware\arduino\avr\libraries\Wire
使用 1.4 版本的库 DS1307RTC 在文件夹: C:\Users\Administrator\Documents\Arduino\libraries\DS1307RTC
exit status 1
'tmElements_t' does not name a type
3.