查看: 153|回复: 2

[未解决] DS3231库出了问题,不知怎么解决

[复制链接]
  • TA的每日心情
    奋斗
    2019-8-23 00:00
  • 签到天数: 26 天

    [LV.4]偶尔看看III

    发表于 2019-8-14 22:00 | 显示全部楼层 |阅读模式
    本帖最后由 zjssun 于 2019-8-15 09:41 编辑

    Arduino:1.8.9 (Windows Store 1.8.21.0) (Windows 10), 开发板:"WeMos D1 R1, 80 MHz, Flash, Disabled, All SSL ciphers (most compatible), 4M (no SPIFFS), v2 Lower Memory, Disabled, None, Only Sketch, 115200"

    In file included from C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:22:0:

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:66:2: error: 'uint8_t' does not name a type

      uint8_t  hour;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:67:2: error: 'uint8_t' does not name a type

      uint8_t  min;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:68:2: error: 'uint8_t' does not name a type

      uint8_t  sec;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:69:2: error: 'uint8_t' does not name a type

      uint8_t  date;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:70:2: error: 'uint8_t' does not name a type

      uint8_t  mon;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:71:2: error: 'uint16_t' does not name a type

      uint16_t year;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:72:2: error: 'uint8_t' does not name a type

      uint8_t  dow;

      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:80:18: error: expected ')' before 'data_pin'

       DS3231(uint8_t data_pin, uint8_t sclk_pin);

                      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:83:16: error: 'uint8_t' has not been declared

       void setTime(uint8_t hour, uint8_t min, uint8_t sec);

                    ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:83:30: error: 'uint8_t' has not been declared

       void setTime(uint8_t hour, uint8_t min, uint8_t sec);

                                  ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:83:43: error: 'uint8_t' has not been declared

       void setTime(uint8_t hour, uint8_t min, uint8_t sec);

                                               ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:84:16: error: 'uint8_t' has not been declared

       void setDate(uint8_t date, uint8_t mon, uint16_t year);

                    ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:84:30: error: 'uint8_t' has not been declared

       void setDate(uint8_t date, uint8_t mon, uint16_t year);

                                  ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:84:43: error: 'uint16_t' has not been declared

       void setDate(uint8_t date, uint8_t mon, uint16_t year);

                                               ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:86:15: error: 'uint8_t' has not been declared

       void setDOW(uint8_t dow);

                   ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:88:9: error: expected ';' at end of member declaration

       char *getTimeStr(uint8_t format=FORMAT_LONG);

             ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:88:28: error: expected ')' before 'format'

       char *getTimeStr(uint8_t format=FORMAT_LONG);

                                ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:89:9: error: expected ';' at end of member declaration

       char *getDateStr(uint8_t slformat=FORMAT_LONG, uint8_t eformat=FORMAT_LITTLEENDIAN, char divider='.');

             ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:89:28: error: expected ')' before 'slformat'

       char *getDateStr(uint8_t slformat=FORMAT_LONG, uint8_t eformat=FORMAT_LITTLEENDIAN, char divider='.');

                                ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:90:9: error: expected ';' at end of member declaration

       char *getDOWStr(uint8_t format=FORMAT_LONG);

             ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:90:27: error: expected ')' before 'format'

       char *getDOWStr(uint8_t format=FORMAT_LONG);

                               ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:91:9: error: expected ';' at end of member declaration

       char *getMonthStr(uint8_t format=FORMAT_LONG);

             ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:91:29: error: expected ')' before 'format'

       char *getMonthStr(uint8_t format=FORMAT_LONG);

                                 ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:95:18: error: 'byte' has not been declared

       void setOutput(byte enable);

                      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:100:3: error: 'uint8_t' does not name a type

       uint8_t _scl_pin;

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:101:3: error: 'uint8_t' does not name a type

       uint8_t _sda_pin;

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:102:3: error: 'uint8_t' does not name a type

       uint8_t _burstArray[7];

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:103:3: error: 'boolean' does not name a type

       boolean _use_hw;

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:105:19: error: 'byte' has not been declared

       void _sendStart(byte addr);

                       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:110:3: error: 'uint8_t' does not name a type

       uint8_t _readByte();

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:111:19: error: 'uint8_t' has not been declared

       void _writeByte(uint8_t value);

                       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:113:3: error: 'uint8_t' does not name a type

       uint8_t _readRegister(uint8_t reg);

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:114:24: error: 'uint8_t' has not been declared

       void  _writeRegister(uint8_t reg, uint8_t value);

                            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:114:37: error: 'uint8_t' has not been declared

       void  _writeRegister(uint8_t reg, uint8_t value);

                                         ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:115:3: error: 'uint8_t' does not name a type

       uint8_t _decode(uint8_t value);

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:116:3: error: 'uint8_t' does not name a type

       uint8_t _decodeH(uint8_t value);

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:117:3: error: 'uint8_t' does not name a type

       uint8_t _decodeY(uint8_t value);

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.h:118:3: error: 'uint8_t' does not name a type

       uint8_t _encode(uint8_t vaule);

       ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:48:14: error: 'uint8_t' does not name a type

    static const uint8_t dim[] = { 31,28,31,30,31,30,31,31,30,31,30,31 };

                  ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp: In constructor 'Time::Time()':

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:54:8: error: 'class Time' has no member named 'year'

      this->year = 2014;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:55:8: error: 'class Time' has no member named 'mon'

      this->mon  = 1;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:56:8: error: 'class Time' has no member named 'date'

      this->date = 1;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:57:8: error: 'class Time' has no member named 'hour'

      this->hour = 0;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:58:8: error: 'class Time' has no member named 'min'

      this->min  = 0;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:59:8: error: 'class Time' has no member named 'sec'

      this->sec  = 0;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:60:8: error: 'class Time' has no member named 'dow'

      this->dow  = 3;

            ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp: At global scope:

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:63:15: error: expected constructor, destructor, or type conversion before '(' token

    DS3231:S3231(uint8_t data_pin, uint8_t sclk_pin)

                   ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp: In member function 'Time DS3231::getTime()':

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:73:4: error: 'class Time' has no member named 'sec'

      t.sec = _decode(_burstArray[0]);

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:73:18: error: '_burstArray' was not declared in this scope

      t.sec = _decode(_burstArray[0]);

                      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:73:32: error: '_decode' was not declared in this scope

      t.sec = _decode(_burstArray[0]);

                                    ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:74:4: error: 'class Time' has no member named 'min'

      t.min = _decode(_burstArray[1]);

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:75:4: error: 'class Time' has no member named 'hour'

      t.hour = _decodeH(_burstArray[2]);

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:75:34: error: '_decodeH' was not declared in this scope

      t.hour = _decodeH(_burstArray[2]);

                                      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:76:4: error: 'class Time' has no member named 'dow'

      t.dow = _burstArray[3];

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:77:4: error: 'class Time' has no member named 'date'

      t.date = _decode(_burstArray[4]);

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:78:4: error: 'class Time' has no member named 'mon'

      t.mon = _decode(_burstArray[5]);

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:79:4: error: 'class Time' has no member named 'year'

      t.year = _decodeY(_burstArray[6])+2000;

        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:79:34: error: '_decodeY' was not declared in this scope

      t.year = _decodeY(_burstArray[6])+2000;

                                      ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp: At global scope:

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:83:22: error: variable or field 'setTime' declared void

    void DS3231::setTime(uint8_t hour, uint8_t min, uint8_t sec)

                          ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:83:22: error: 'uint8_t' was not declared in this scope

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:83:36: error: 'uint8_t' was not declared in this scope

    void DS3231::setTime(uint8_t hour, uint8_t min, uint8_t sec)

                                        ^

    C:\Users\16285\Documents\Arduino\libraries\DS3231\DS3231.cpp:83:49: error: 'uint8_t' was not declared in this scope

    void DS3231::setTime(uint8_t hour, uint8_t min, uint8_t sec)

                                                     ^

    exit status 1
    为开发板 WeMos D1 R1 编译时出错。

    kittenblock中小学创客名师推荐的图形化编程软件

    // DS3231_Serial_Easy
    // Copyright (C)2015 Rinky-Dink Electronics, Henning Karlsen. All right reserved
    // web: http://www.RinkyDinkElectronics.com/
    //
    // A quick demo of how to use my DS3231-library to 
    // quickly send time and date information over a serial link
    //
    // To use the hardware I2C (TWI) interface of the Arduino you must connect
    // the pins as follows:
    //
    // Arduino Uno/2009:
    // ----------------------
    // DS3231:  SDA pin   -> Arduino Analog 4 or the dedicated SDA pin
    //          SCL pin   -> Arduino Analog 5 or the dedicated SCL pin
    //
    // Arduino Leonardo:
    // ----------------------
    // DS3231:  SDA pin   -> Arduino Digital 2 or the dedicated SDA pin
    //          SCL pin   -> Arduino Digital 3 or the dedicated SCL pin
    //
    // Arduino Mega:
    // ----------------------
    // DS3231:  SDA pin   -> Arduino Digital 20 (SDA) or the dedicated SDA pin
    //          SCL pin   -> Arduino Digital 21 (SCL) or the dedicated SCL pin
    //
    // Arduino Due:
    // ----------------------
    // DS3231:  SDA pin   -> Arduino Digital 20 (SDA) or the dedicated SDA1 (Digital 70) pin
    //          SCL pin   -> Arduino Digital 21 (SCL) or the dedicated SCL1 (Digital 71) pin
    //
    // The internal pull-up resistors will be activated when using the 
    // hardware I2C interfaces.
    //
    // You can connect the DS3231 to any available pin but if you use any
    // other than what is described above the library will fall back to
    // a software-based, TWI-like protocol which will require exclusive access 
    // to the pins used, and you will also have to use appropriate, external
    // pull-up resistors on the data and clock signals.
    //
    
    #include <DS3231.h>
    
    // Init the DS3231 using the hardware interface
    DS3231  rtc(SDA, SCL);
    
    void setup()
    {
      // Setup Serial connection
      Serial.begin(115200);
      // Uncomment the next line if you are using an Arduino Leonardo
      //while (!Serial) {}
      
      // Initialize the rtc object
      rtc.begin();
      
      // The following lines can be uncommented to set the date and time
      rtc.setDOW(WEDNESDAY);     // Set Day-of-Week to SUNDAY
      rtc.setTime(12, 0, 0);     // Set the time to 12:00:00 (24hr format)
      rtc.setDate(1, 1, 2014);   // Set the date to January 1st, 2014
    }
    
    void loop()
    {
      // Send Day-of-Week
      Serial.print(rtc.getDOWStr());
      Serial.print(" ");
      
      // Send date
      Serial.print(rtc.getDateStr());
      Serial.print(" -- ");
    
      // Send time
      Serial.println(rtc.getTimeStr());
      
      // Wait one second before repeating 
      delay (1000);
    }












  • TA的每日心情
    奋斗
    2019-8-23 00:00
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2019-8-14 22:28 | 显示全部楼层
    本帖最后由 zjssun 于 2019-8-15 09:41 编辑

    还没有解决
  • TA的每日心情
    奋斗
    2019-8-23 00:00
  • 签到天数: 26 天

    [LV.4]偶尔看看III

     楼主| 发表于 2019-8-15 12:09 | 显示全部楼层

    ..............
    您需要登录后才可以回帖 登录 | 立即注册  

    本版积分规则

    热门推荐

    Arduino lcd屏幕亮了但是不显示字符
    Arduino lcd屏幕亮了但是
    Arduino的lcd屏亮了但是上面没有字符显示,串进去的滑动变阻器也旋过了,但是还是没有
    【原创】全球最小口袋3D打印机mini one直播教程贴
    【原创】全球最小口袋3D打
    最近闲得蛋疼,没事搞个掌上3D打印机,先放效果图吧。 搞了半天,终于能正常打印,
    [限时福利]5分钟带你快速了解新一代开发板:M5STACK
    [限时福利]5分钟带你快速
    一、什么是M5Stack M5Stack是一种模块化、可堆叠扩展的开发板,每个模块
    【Arduino】108种传感器模块系列实验(98)---L298N电机驱动板
    【Arduino】108种传感器模
    37款传感器与模块的提法,在网络上广泛流传,其实Arduino能够兼容的传感器模块肯定是
    两个ESP8266通过云端实现远程数据交互
    两个ESP8266通过云端实现
    原理简述:利用发布订阅模式。一个ESP8266作为消息发布者,另一个ESP8266作为消息订阅
    Copyright   ©2015-2016  Arduino中文社区  Powered by©Discuz!   ( 蜀ICP备14017632号-3 )
    快速回复 返回顶部 返回列表