Война с ардуино или полный чайник
- Войдите на сайт для отправки комментариев
Втр, 08/03/2016 - 19:10
Ребят доброго времени суток=) столкнулся вот с такой бедой=)
имеется Arduino Due всякие светодиодные ленты, датчики температуры, часы реального времени ds3231.
аквариумная банка с рыбками на 130 литров=) что хочу=)
Использвать чужой скейтч для контроллера аквариумного, но вот незадача, при проверке вываливается ошибка, перерыл гору инфы, но так и не смог найти ничего дельного по этому вопросу, надеюсь тут кто нибудь поможет.
/*Скетч с использованием UNIX-времени По материалам www.aqa.ru и благодаря стараниям ZORS Версия от 06 ноября 2014 Управление 4-мя реле (СО2, термореле воды и радиаторов ЛЭД, вкл/выкл драйверов ЛЭД) ШИМ ЛЭД по 2-м каналам Вывод на экран температуры, времени, даты, состояния включенных функций Коррекция неточных RTC Работа с 5-ю кнопками: вкл/выкл подсветки дисплея меню дисплея, время на 21:00, управление СО2, светом. */ //Загрузка библиотек #include <OneWire.h> #include <Wire.h> #include <LiquidCrystal_I2C.h> //#include <RTClib.h> //Установка экрана LiquidCrystal_I2C lcd(0x27,16,2); //Подключение выходов const int RelCO2 = 4; //реле СО2 на выходе 4 const int RelLdd = 7;//выход 7 реле DC для драйверов LDD const int Led1 = 5; //ШИМ утро-вечер выходе 5 const int Led2 = 6; //ШИМ день на выходе 6 const int TermRel1 = 8;//выход 8 для реле термодатчика воды const int TermRel2 = 12; //выход 12 для реле радиаторов //Установки параметров ШИМ #define PWM_MIN 0 //минимальное значение ШИМ #define PWM_MAX 60//значение ШИМ для теплых диодов #define PWM_LOW 150//значение ШИМ для холодных диодов //Значения минут и часов в секундах #define mn 60UL #define hr 3600UL //Установки времени вкл\выкл ШИМ-сигнала на 5 и 6 выходах (время в секундах UNIX) const long Led1On = 12*hr;//время включения теплых диодов на 5 выходе (начало восхода) const long Led1Off = 20*hr;//выключение (начало заката) const long Led1Dur = 120*mn;//длительность восхода-заката при помощи ШИМ const long Led2On = 15*hr;//включение основных диодов на 6 выходе const long Led2Off = 20*hr;//начало выключения основных диодов const long Led2Dur = 15*mn;//длительность диммирования основных диодов const long CO2On = Led2On-hr;//включение СО2 const long CO2Off = Led2Off+Led2Dur;//выключение СО2 //Установка RTC и их коррекция RTC_DS1307 RTC; uint32_t TimeAdjustPeriod = 38*mn; //корректирровка времени на -1 сек за 38 мин uint32_t TimeCorrection = 1; unsigned long nextAdjustTime = 0; //Установки для печати месяцев на экране const char* months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul","Aug", "Sep", "Oct", "Nov", "Dec"}; //Установки для термодатчика int TSensorPin1 = 10; int TSensorPin2 = 9; OneWire ds1(TSensorPin1);// создаем объект температурного датчика OneWire ds2(TSensorPin2); float t1 = 27.0;//установка температуры float tGist1 = 0.5;//установка гистерезиса //Установки для кнопки СО2 на выходе 2 const int ButtonCO2 = 2; boolean flagCO2 = false; int regimCO2 = 1; //Установки для кнопок "Время 21:00", "Свет" и "Подсветка LCD на аналоговом входе А0 const int ButtonA0 = A0; int analogA0 = 0; boolean flagA0 = false; int regimA0 = 1; boolean flagA0LCD = false; int regimA0LCD = 1;//Установки для кнопки "Меню экрана" на выходе 3 const int ButtonMenu = 3; boolean flagMenu = false; int regimMenu = 1; //********************************************************* void setup () { Wire.begin(); RTC.begin(); //RTC.adjust(DateTime(__DATE__, __TIME__)); // строка только для первой компиляции!!! DateTime myTime = RTC.now(); //RTC.adjust(DateTime(myTime.unixtime()+15)); //строка только для первой компиляции!!! RTC.adjust(DateTime(myTime.unixtime()+3));//для второй компиляции, коррекция при перезагрузках Arduino на 3 сек. //Первоначальные установки выходов pinMode (RelCO2, OUTPUT); pinMode (RelLdd, OUTPUT); pinMode (TermRel1, OUTPUT); pinMode (TermRel2, OUTPUT); digitalWrite (RelCO2, LOW); digitalWrite (RelLdd, LOW); digitalWrite (TermRel1, LOW); digitalWrite (TermRel2, LOW); analogWrite(Led1, PWM_MIN); analogWrite(Led2, PWM_MIN); //Первоначальные надписи на дисплее lcd.init(); lcd.backlight(); lcd.clear(); lcd.setCursor(5, 0); lcd.print("iAQUA");//Слава мне, любимому lcd.setCursor(3, 1); lcd.print("v.6.11.14"); delay (3000); lcd.clear(); lcd.noBacklight(); } //*************************************************** void loop () { //Работа часов с коррекцией DateTime myTime = RTC.now(); uint32_t UTime = myTime.unixtime(); if (UTime > nextAdjustTime){ nextAdjustTime = UTime+TimeAdjustPeriod; RTC.adjust(DateTime(UTime-TimeCorrection)); } UTime %=86400; analogA0=analogRead(A0); if (analogA0>685 && analogA0<710)//коррекция времени нажатием кнопки (21:00) { DateTime myTime = RTC.now(); uint32_t UTime = myTime.unixtime(); UTime = 75600 + (UTime-UTime%86400); RTC.adjust(DateTime(UTime)); } if (analogA0>810 && analogA0<840 && !flagA0)//ручное и автоматическое управление светом { regimA0++; flagA0 = true; if (regimA0>3) { regimA0=1; } } else if (analogA0<810 && flagA0) { flagA0=false; } if (regimA0==1) { if ((UTime>=(Led1On-1*mn)) && (UTime<(Led1Off+Led1Dur+1*mn)))//время вкл/выкл драйверов в авто-режиме { digitalWrite(RelLdd, HIGH); long pwm; if ((UTime<Led1On) || (UTime>=Led1Off + Led1Dur)) { pwm=PWM_MIN; } else if((UTime>=Led1On) && (UTime<(Led1On + Led1Dur))) { pwm = ((UTime - Led1On)*(PWM_MAX-PWM_MIN)) / Led1Dur; } else if((UTime>=Led1Off) && (UTime<Led1Off + Led1Dur)) { pwm=((Led1Off + Led1Dur - UTime)*(PWM_MAX-PWM_MIN))/Led1Dur; } else { pwm=PWM_MAX; } analogWrite(Led1, pwm); if ((UTime<Led2On) || (UTime>=Led2Off + Led2Dur)) { pwm=PWM_MIN; } else if((UTime>=Led2On) && (UTime<(Led2On + Led2Dur))) { pwm = ((UTime - Led2On)*(PWM_LOW-PWM_MIN)) / Led2Dur; } else if((UTime>=Led2Off) && (UTime<Led2Off + Led2Dur)) { pwm=((Led2Off + Led2Dur - UTime)*(PWM_LOW-PWM_MIN))/Led2Dur; } else { pwm=PWM_LOW; } analogWrite(Led2, pwm); } else { digitalWrite(RelLdd, LOW); } } if (regimA0 ==2)//выключение всех диодов в ручной режиме { digitalWrite(RelLdd, LOW); } if (regimA0 ==3)//включение теплых диодов в ручном режиме { digitalWrite(RelLdd, HIGH); analogWrite(Led1, PWM_LOW); analogWrite(Led2, PWM_MIN); } if (analogA0>580 && analogA0<610 && !flagA0LCD)//управление подсветкой экрана { regimA0LCD++; flagA0LCD = true; if (regimA0LCD > 2) { regimA0LCD = 1; } } else if(analogA0 < 580 && flagA0LCD) { flagA0LCD = false; } if (regimA0LCD==1) { lcd.noBacklight(); } if (regimA0LCD !=1) { lcd.backlight(); } //Управление СО2 if (digitalRead(ButtonCO2)==HIGH && !flagCO2) { regimCO2++; flagCO2=true; if(regimCO2>3) { regimCO2=1; } } else if (digitalRead(ButtonCO2)==LOW && flagCO2) { flagCO2=false; } if(regimCO2==1) { if (UTime>=CO2On && UTime<CO2Off) { digitalWrite (RelCO2, HIGH); } else { digitalWrite (RelCO2, LOW); } } else if(regimCO2==2) { digitalWrite(RelCO2, HIGH); } else if(regimCO2==3) { digitalWrite(RelCO2, LOW); } //управление термореле воды в период 9:00-22:00 float temp1 = getTemp1(); //lcd.setCursor(9,1); if((temp1 > (t1 + tGist1)) && (UTime >= 9*hr) && (UTime < 22*hr)) { digitalWrite(TermRel1,HIGH); } else if ((temp1 < (t1 - tGist1)) || UTime <9*hr || UTime >= 22*hr) { digitalWrite(TermRel1,LOW); } float temp2 = getTemp2();//управление термореле радиаторов if (UTime>=Led1On && UTime<(Led1Off+Led1Dur)) { digitalWrite(TermRel2, HIGH); } else if (UTime<Led1On || UTime>=Led1Off) { digitalWrite(TermRel2, LOW); } //Управление кнопкой "Меню экрана" if (digitalRead(ButtonMenu)==HIGH && !flagMenu) { lcd.clear(); flagMenu = true; regimMenu ++; if (regimMenu>3) { regimMenu=1; } } else if (digitalRead(ButtonMenu)==LOW && flagMenu) { flagMenu=false; } if (regimMenu==1) //меню "1" вывод на экран времени и календаря { lcd.setCursor(4, 0); if (myTime.hour() < 10) lcd.print ("0"); lcd.print(myTime.hour()); lcd.print(':'); if (myTime.minute() < 10) lcd.print ("0"); lcd.print(myTime.minute()); lcd.print(':'); if (myTime.second() < 10) lcd.print ("0"); lcd.print(myTime.second()); lcd.setCursor(0, 1); if (myTime.day() < 10) lcd.print ("0"); lcd.print(myTime.day()); lcd.setCursor(3, 1); lcd.print (months[myTime.month()-1]); lcd.setCursor(7,1); lcd.print(myTime.year()); lcd.setCursor(13,1); int dow = (myTime.dayOfWeek()); switch (dow){ case 0: lcd.print("Sun"); break; case 1: lcd.print("Mon"); break; case 2: lcd.print("Tue"); break; case 3: lcd.print("Wed"); break; case 4: lcd.print("Thu"); break; case 5: lcd.print("Fri"); break; case 6: lcd.print("Sat"); break; } } else if (regimMenu==2)//меню "2" вывод на экран CO2, T, режима работы диодов { lcd.setCursor(0,0); lcd.print("CO2"); lcd.setCursor(4,0); if (digitalRead(RelCO2)==HIGH) { lcd.print("On "); } else { lcd.print("Off"); } lcd.setCursor(8,0); if (regimCO2 == 1) { lcd.print("Auto"); } else if (regimCO2 !=1) { lcd.print("Hand"); } lcd.setCursor(13,1); if(UTime<Led1On || UTime >=(Led1Off+Led1Dur)) { lcd.print("Ngt"); } else if (UTime>=(Led1On) && UTime < Led2On) { lcd.print("Mrg"); } else if(UTime >= Led2On && UTime < Led2Off) { lcd.print("Day"); } else if (UTime >= Led2Off && UTime < (Led1Off+Led1Dur)) { lcd.print("Evg"); } lcd.setCursor(0,1); if (digitalRead(RelLdd)==HIGH && regimA0 ==1) { lcd.print("LED On Auto"); } else if (digitalRead(RelLdd) == LOW && regimA0 ==1) { lcd.print("LED Off Auto"); } else if (digitalRead(RelLdd) == HIGH && regimA0 ==3) { lcd.print("LED On Hand"); } else { lcd.print("LED Off Hand"); } } else if(regimMenu==3)// меню "3" вывод на экран температуры { lcd.setCursor(0,0); lcd.print("Water t="); lcd.print(temp1,1); lcd.setCursor(13,0); if (digitalRead(TermRel1)==HIGH) { lcd.print("*"); } else { lcd.print(" "); } lcd.setCursor(0,1); lcd.print("Air t="); lcd.print(temp2,1); lcd.setCursor(13,1); } } //***************************************************** //Функции чтения с датчиков температуры float getTemp1(){ byte data[12]; byte addr[8]; if ( !ds1.search(addr)) { //no more sensors on chain, reset search ds1.reset_search(); return -1001; } if ( OneWire::crc8( addr, 7) != addr[7]) { return -1002; } if ( addr[0] != 0x10 && addr[0] != 0x28) { return -1003; } ds1.reset(); ds1.select(addr); ds1.write(0x44,1); byte present = ds1.reset(); ds1.select(addr); ds1.write(0xBE); for (int i = 0; i < 9; i++) { data[i] = ds1.read(); } ds1.reset_search(); byte MSB = data[1]; byte LSB = data[0]; float TRead = ((MSB<<8) | LSB); float Temperature = TRead / 16; return Temperature; } float getTemp2(){ byte data[12]; byte addr[8]; if ( !ds2.search(addr)) { //no more sensors on chain, reset search ds2.reset_search(); return -1001; } if ( OneWire::crc8( addr, 7) != addr[7]) { return -1002; } if ( addr[0] != 0x10 && addr[0] != 0x28) { return -1003; } ds2.reset(); ds2.select(addr); ds2.write(0x44,1); byte present = ds2.reset(); ds2.select(addr); ds2.write(0xBE); for (int i = 0; i < 9; i++) { data[i] = ds2.read(); } ds2.reset_search(); byte MSB = data[1]; byte LSB = data[0]; float TRead = ((MSB<<8) | LSB); float Temperature = TRead / 16; return Temperature; } Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" In file included from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3xa.h:44:0, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3.h:59, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam.h:198, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/libsam/chip.h:25, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\cores\arduino/Arduino.h:42, from sketch\iAqua.ino.cpp:1: C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:20: error: expected constructor, destructor, or type conversion before '(' token #define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */ ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino:51:12: note: in expansion of macro 'RTC' RTC_DS1307 RTC; ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void setup()': iAqua:92: error: request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.begin(); ^ iAqua:94: error: 'DateTime' was not declared in this scope DateTime myTime = RTC.now(); ^ iAqua:94: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:96: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(myTime.unixtime()+3));//для второй компиляции, коррекция РїСЂРё перезагрузках Arduino РЅР° 3 сек. ^ iAqua:96: error: 'myTime' was not declared in this scope RTC.adjust(DateTime(myTime.unixtime()+3));//для второй компиляции, коррекция РїСЂРё перезагрузках Arduino РЅР° 3 сек. ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:126: error: 'DateTime' was not declared in this scope DateTime myTime = RTC.now(); ^ iAqua:126: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:127: error: 'myTime' was not declared in this scope uint32_t UTime = myTime.unixtime(); ^ iAqua:130: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:136: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:139: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ exit status 1 request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > Настройки
Для начала, попробуйте раскомментировать:
эт я уже об безисходности закоментил библиотеку
Похоже, не ту библиотеку прикрутил. Ты используеш от DS1307, а надо судя по всему DS3231. Еще могут конфликтовать библиотеки, удали все, кроме RTClib.h
К сожалению, тоже не сходится=( лежит только одна библиотека RTClib
и для ds3231 отдельная библиотека DS3231_TEST
Народ говорят что это не имеет никакой разницы, что 3231 работает и с библиотекой 1307, так как адреса одинаковые.
Начнем отладку :)
Убираем всё. Оставляем:
Компилится?
Кстати, вот обсуждение Вашего случая тыц с решением.
читал, но так и не смог понять о чем речь, тот код который Вы дали, не компилируется, указывает на строчку RTC.begin();
и код ошибки:
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" In file included from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3xa.h:44:0, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3.h:59, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam.h:198, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/libsam/chip.h:25, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\cores\arduino/Arduino.h:42, from sketch\sketch_mar09a.ino.cpp:1: C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token #define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */ ^ C:\Users\Agedo\Documents\Arduino\sketch_mar09a\sketch_mar09a.ino:51:12: note: in expansion of macro 'RTC' RTC_DS1307 RTC; ^ C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token #define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */ ^ C:\Users\Agedo\Documents\Arduino\sketch_mar09a\sketch_mar09a.ino:51:12: note: in expansion of macro 'RTC' RTC_DS1307 RTC; ^ C:\Users\Agedo\Documents\Arduino\sketch_mar09a\sketch_mar09a.ino: In function 'void setup()': sketch_mar09a:92: error: request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.begin(); ^ sketch_mar09a:94: error: request for member 'now' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) DateTime myTime = RTC.now(); ^ exit status 1 request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > Настройкизаменил беблиотеку на соответсвующую устройству ds3231
суть осталась та же:
В том решении говорится, что в sam3x8e.h уже определен объект/тип RTC. Именно поэтому неозможно подключить DS1307 как RTC (кстати в первом посте Вы говорили о ds3231).
Попробуйте в 52 строке ( и далее во всём скетче) заменить RTC на myRTC.
не дало результатов, сейчас ковыряюсь в библиотеках, все равно темный лес, может вы подскажете что в коде изменить.
DS3231.h
DS3231.cpp
/* DS3231.cpp: DS3231 Real-Time Clock library original code by Eric Ayars 4/1/11 updated to Arduino 1.0 John Hubert Feb 7, 2012 Released into the public domain. */ #include <DS3231.h> #define CLOCK_ADDRESS 0x68 // Constructor DS3231::DS3231() { // nothing to do for this constructor. } /***************************************** Public Functions *****************************************/ void DS3231::getTime(byte& year, byte& month, byte& date, byte& DoW, byte& hour, byte& minute, byte& second) { byte tempBuffer; bool PM; bool h12; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x00)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 7); second = bcdToDec(Wire.read()); minute = bcdToDec(Wire.read()); tempBuffer = bcdToDec(Wire.read()); h12 = tempBuffer & 0b01000000; if (h12) { PM = tempBuffer & 0b00100000; hour = bcdToDec(tempBuffer & 0b00011111); } else { hour = bcdToDec(tempBuffer & 0b00111111); } DoW = bcdToDec(Wire.read()); date = bcdToDec(Wire.read()); month = bcdToDec(Wire.read() & 0b01111111); year = bcdToDec(Wire.read()); } byte DS3231::getSecond() { Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x00)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return bcdToDec(Wire.read()); } byte DS3231::getMinute() { Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(0x01); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return bcdToDec(Wire.read()); } byte DS3231::getHour(bool& h12, bool& PM) { byte temp_buffer; byte hour; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(0x02); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); temp_buffer = Wire.read(); h12 = temp_buffer & 0b01000000; if (h12) { PM = temp_buffer & 0b00100000; hour = bcdToDec(temp_buffer & 0b00011111); } else { hour = bcdToDec(temp_buffer & 0b00111111); } return hour; } byte DS3231::getDoW() { Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x03)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return bcdToDec(Wire.read()); } byte DS3231::getDate() { Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x04)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return bcdToDec(Wire.read()); } byte DS3231::getMonth(bool& Century) { byte temp_buffer; byte hour; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x05)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); temp_buffer = Wire.read(); Century = temp_buffer & 0b10000000; return (bcdToDec(temp_buffer & 0b01111111)) ; } byte DS3231::getYear() { Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x06)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return bcdToDec(Wire.read()); } void DS3231::setSecond(byte Second) { // Sets the seconds // This function also resets the Oscillator Stop Flag, which is set // whenever power is interrupted. Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x00)); Wire.write(decToBcd(Second)); Wire.endTransmission(); // Clear OSF flag byte temp_buffer = readControlByte(1); writeControlByte((temp_buffer & 0b01111111), 1); } void DS3231::setMinute(byte Minute) { // Sets the minutes Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x01)); Wire.write(decToBcd(Minute)); Wire.endTransmission(); } void DS3231::setHour(byte Hour) { // Sets the hour, without changing 12/24h mode. // The hour must be in 24h format. bool h12; // Start by figuring out what the 12/24 mode is Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x02)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); h12 = (Wire.read() & 0b01000000); // if h12 is true, it's 12h mode; false is 24h. if (h12) { // 12 hour if (Hour > 12) { Hour = decToBcd(Hour-12) | 0b01100000; } else { Hour = decToBcd(Hour) & 0b11011111; } } else { // 24 hour Hour = decToBcd(Hour) & 0b10111111; } Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x02)); Wire.write(Hour); Wire.endTransmission(); } void DS3231::setDoW(byte DoW) { // Sets the Day of Week Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x03)); Wire.write(decToBcd(DoW)); Wire.endTransmission(); } void DS3231::setDate(byte Date) { // Sets the Date Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x04)); Wire.write(decToBcd(Date)); Wire.endTransmission(); } void DS3231::setMonth(byte Month) { // Sets the month Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x05)); Wire.write(decToBcd(Month)); Wire.endTransmission(); } void DS3231::setYear(byte Year) { // Sets the year Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x06)); Wire.write(decToBcd(Year)); Wire.endTransmission(); } void DS3231::setClockMode(bool h12) { // sets the mode to 12-hour (true) or 24-hour (false). // One thing that bothers me about how I've written this is that // if the read and right happen at the right hourly millisecnd, // the clock will be set back an hour. Not sure how to do it better, // though, and as long as one doesn't set the mode frequently it's // a very minimal risk. // It's zero risk if you call this BEFORE setting the hour, since // the setHour() function doesn't change this mode. byte temp_buffer; // Start by reading byte 0x02. Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x02)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); temp_buffer = Wire.read(); // Set the flag to the requested value: if (h12) { temp_buffer = temp_buffer | 0b01000000; } else { temp_buffer = temp_buffer & 0b10111111; } // Write the byte Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x02)); Wire.write(temp_buffer); Wire.endTransmission(); } float DS3231::getTemperature() { // Checks the internal thermometer on the DS3231 and returns the // temperature as a floating-point value. byte temp; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x11)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 2); temp = Wire.read(); // Here's the MSB return float(temp) + 0.25*(Wire.read()>>6); } void DS3231::getA1Time(byte& A1Day, byte& A1Hour, byte& A1Minute, byte& A1Second, byte& AlarmBits, bool& A1Dy, bool& A1h12, bool& A1PM) { byte temp_buffer; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x07)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 4); temp_buffer = Wire.read(); // Get A1M1 and A1 Seconds A1Second = bcdToDec(temp_buffer & 0b01111111); // put A1M1 bit in position 0 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>7; temp_buffer = Wire.read(); // Get A1M2 and A1 minutes A1Minute = bcdToDec(temp_buffer & 0b01111111); // put A1M2 bit in position 1 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>6; temp_buffer = Wire.read(); // Get A1M3 and A1 Hour // put A1M3 bit in position 2 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>5; // determine A1 12/24 mode A1h12 = temp_buffer & 0b01000000; if (A1h12) { A1PM = temp_buffer & 0b00100000; // determine am/pm A1Hour = bcdToDec(temp_buffer & 0b00011111); // 12-hour } else { A1Hour = bcdToDec(temp_buffer & 0b00111111); // 24-hour } temp_buffer = Wire.read(); // Get A1M4 and A1 Day/Date // put A1M3 bit in position 3 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>4; // determine A1 day or date flag A1Dy = (temp_buffer & 0b01000000)>>6; if (A1Dy) { // alarm is by day of week, not date. A1Day = bcdToDec(temp_buffer & 0b00001111); } else { // alarm is by date, not day of week. A1Day = bcdToDec(temp_buffer & 0b00111111); } } void DS3231::getA2Time(byte& A2Day, byte& A2Hour, byte& A2Minute, byte& AlarmBits, bool& A2Dy, bool& A2h12, bool& A2PM) { byte temp_buffer; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x0b)); Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 3); temp_buffer = Wire.read(); // Get A2M2 and A2 Minutes A2Minute = bcdToDec(temp_buffer & 0b01111111); // put A2M2 bit in position 4 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>3; temp_buffer = Wire.read(); // Get A2M3 and A2 Hour // put A2M3 bit in position 5 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>2; // determine A2 12/24 mode A2h12 = temp_buffer & 0b01000000; if (A2h12) { A2PM = temp_buffer & 0b00100000; // determine am/pm A2Hour = bcdToDec(temp_buffer & 0b00011111); // 12-hour } else { A2Hour = bcdToDec(temp_buffer & 0b00111111); // 24-hour } temp_buffer = Wire.read(); // Get A2M4 and A1 Day/Date // put A2M4 bit in position 6 of DS3231_AlarmBits. AlarmBits = AlarmBits | (temp_buffer & 0b10000000)>>1; // determine A2 day or date flag A2Dy = (temp_buffer & 0b01000000)>>6; if (A2Dy) { // alarm is by day of week, not date. A2Day = bcdToDec(temp_buffer & 0b00001111); } else { // alarm is by date, not day of week. A2Day = bcdToDec(temp_buffer & 0b00111111); } } void DS3231::setA1Time(byte A1Day, byte A1Hour, byte A1Minute, byte A1Second, byte AlarmBits, bool A1Dy, bool A1h12, bool A1PM) { // Sets the alarm-1 date and time on the DS3231, using A1* information byte temp_buffer; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x07)); // A1 starts at 07h // Send A1 second and A1M1 Wire.write(decToBcd(A1Second) | ((AlarmBits & 0b00000001) << 7)); // Send A1 Minute and A1M2 Wire.write(decToBcd(A1Minute) | ((AlarmBits & 0b00000010) << 6)); // Figure out A1 hour if (A1h12) { // Start by converting existing time to h12 if it was given in 24h. if (A1Hour > 12) { // well, then, this obviously isn't a h12 time, is it? A1Hour = A1Hour - 12; A1PM = true; } if (A1PM) { // Afternoon // Convert the hour to BCD and add appropriate flags. temp_buffer = decToBcd(A1Hour) | 0b01100000; } else { // Morning // Convert the hour to BCD and add appropriate flags. temp_buffer = decToBcd(A1Hour) | 0b01000000; } } else { // Now for 24h temp_buffer = decToBcd(A1Hour); } temp_buffer = temp_buffer | ((AlarmBits & 0b00000100)<<5); // A1 hour is figured out, send it Wire.write(temp_buffer); // Figure out A1 day/date and A1M4 temp_buffer = ((AlarmBits & 0b00001000)<<4) | decToBcd(A1Day); if (A1Dy) { // Set A1 Day/Date flag (Otherwise it's zero) temp_buffer = temp_buffer | 0b01000000; } Wire.write(temp_buffer); // All done! Wire.endTransmission(); } void DS3231::setA2Time(byte A2Day, byte A2Hour, byte A2Minute, byte AlarmBits, bool A2Dy, bool A2h12, bool A2PM) { // Sets the alarm-2 date and time on the DS3231, using A2* information byte temp_buffer; Wire.beginTransmission(CLOCK_ADDRESS); Wire.write(uint8_t(0x0b)); // A1 starts at 0bh // Send A2 Minute and A2M2 Wire.write(decToBcd(A2Minute) | ((AlarmBits & 0b00010000) << 3)); // Figure out A2 hour if (A2h12) { // Start by converting existing time to h12 if it was given in 24h. if (A2Hour > 12) { // well, then, this obviously isn't a h12 time, is it? A2Hour = A2Hour - 12; A2PM = true; } if (A2PM) { // Afternoon // Convert the hour to BCD and add appropriate flags. temp_buffer = decToBcd(A2Hour) | 0b01100000; } else { // Morning // Convert the hour to BCD and add appropriate flags. temp_buffer = decToBcd(A2Hour) | 0b01000000; } } else { // Now for 24h temp_buffer = decToBcd(A2Hour); } // add in A2M3 bit temp_buffer = temp_buffer | ((AlarmBits & 0b00100000)<<2); // A2 hour is figured out, send it Wire.write(temp_buffer); // Figure out A2 day/date and A2M4 temp_buffer = ((AlarmBits & 0b01000000)<<1) | decToBcd(A2Day); if (A2Dy) { // Set A2 Day/Date flag (Otherwise it's zero) temp_buffer = temp_buffer | 0b01000000; } Wire.write(temp_buffer); // All done! Wire.endTransmission(); } void DS3231::turnOnAlarm(byte Alarm) { // turns on alarm number "Alarm". Defaults to 2 if Alarm is not 1. byte temp_buffer = readControlByte(0); // modify control byte if (Alarm == 1) { temp_buffer = temp_buffer | 0b00000101; } else { temp_buffer = temp_buffer | 0b00000110; } writeControlByte(temp_buffer, 0); } void DS3231::turnOffAlarm(byte Alarm) { // turns off alarm number "Alarm". Defaults to 2 if Alarm is not 1. // Leaves interrupt pin alone. byte temp_buffer = readControlByte(0); // modify control byte if (Alarm == 1) { temp_buffer = temp_buffer & 0b11111110; } else { temp_buffer = temp_buffer & 0b11111101; } writeControlByte(temp_buffer, 0); } bool DS3231::checkAlarmEnabled(byte Alarm) { // Checks whether the given alarm is enabled. byte result = 0x0; byte temp_buffer = readControlByte(0); if (Alarm == 1) { result = temp_buffer & 0b00000001; } else { result = temp_buffer & 0b00000010; } return result; } bool DS3231::checkIfAlarm(byte Alarm) { // Checks whether alarm 1 or alarm 2 flag is on, returns T/F accordingly. // Turns flag off, also. // defaults to checking alarm 2, unless Alarm == 1. byte result; byte temp_buffer = readControlByte(1); if (Alarm == 1) { // Did alarm 1 go off? result = temp_buffer & 0b00000001; // clear flag temp_buffer = temp_buffer & 0b11111110; } else { // Did alarm 2 go off? result = temp_buffer & 0b00000010; // clear flag temp_buffer = temp_buffer & 0b11111101; } writeControlByte(temp_buffer, 1); return result; } void DS3231::enableOscillator(bool TF, bool battery, byte frequency) { // turns oscillator on or off. True is on, false is off. // if battery is true, turns on even for battery-only operation, // otherwise turns off if Vcc is off. // frequency must be 0, 1, 2, or 3. // 0 = 1 Hz // 1 = 1.024 kHz // 2 = 4.096 kHz // 3 = 8.192 kHz (Default if frequency byte is out of range) if (frequency > 3) frequency = 3; // read control byte in, but zero out current state of RS2 and RS1. byte temp_buffer = readControlByte(0) & 0b11100111; if (battery) { // turn on BBSQW flag temp_buffer = temp_buffer | 0b01000000; } else { // turn off BBSQW flag temp_buffer = temp_buffer & 0b10111111; } if (TF) { // set ~EOSC to 0 and INTCN to zero. temp_buffer = temp_buffer & 0b01111011; } else { // set ~EOSC to 1, leave INTCN as is. temp_buffer = temp_buffer | 0b10000000; } // shift frequency into bits 3 and 4 and set. frequency = frequency << 3; temp_buffer = temp_buffer | frequency; // And write the control bits writeControlByte(temp_buffer, 0); } void DS3231::enable32kHz(bool TF) { // turn 32kHz pin on or off byte temp_buffer = readControlByte(1); if (TF) { // turn on 32kHz pin temp_buffer = temp_buffer | 0b00001000; } else { // turn off 32kHz pin temp_buffer = temp_buffer & 0b11110111; } writeControlByte(temp_buffer, 1); } bool DS3231::oscillatorCheck() { // Returns false if the oscillator has been off for some reason. // If this is the case, the time is probably not correct. byte temp_buffer = readControlByte(1); bool result = true; if (temp_buffer & 0b10000000) { // Oscillator Stop Flag (OSF) is set, so return false. result = false; } return result; } /***************************************** Private Functions *****************************************/ byte DS3231::decToBcd(byte val) { // Convert normal decimal numbers to binary coded decimal return ( (val/10*16) + (val%10) ); } byte DS3231::bcdToDec(byte val) { // Convert binary coded decimal to normal decimal numbers return ( (val/16*10) + (val%16) ); } byte DS3231::readControlByte(bool which) { // Read selected control byte // first byte (0) is 0x0e, second (1) is 0x0f Wire.beginTransmission(CLOCK_ADDRESS); if (which) { // second control byte Wire.write(uint8_t(0x0f)); } else { // first control byte Wire.write(uint8_t(0x0e)); } Wire.endTransmission(); Wire.requestFrom(CLOCK_ADDRESS, 1); return Wire.read(); } void DS3231::writeControlByte(byte control, bool which) { // Write the selected control byte. // which=false -> 0x0e, true->0x0f. Wire.beginTransmission(CLOCK_ADDRESS); if (which) { Wire.write(uint8_t(0x0f)); } else { Wire.write(uint8_t(0x0e)); } Wire.write(control); Wire.endTransmission(); }На сколько я понял, он предлогает изминить что то в библиотеках, но я так и не понял чего он предлогает сменить, извиняюсь за глупые воросы.
не дало результатов
Какие ошибки получили? (покажитескетч с изменениями и ошибки компиляции)
На сколько я понял, он предлогает изминить что то в библиотеках,
как Вы видите там другая RTC библиотека.
Код скейтча
Ошибка:
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" In file included from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3xa.h:44:0, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3.h:59, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam.h:198, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/libsam/chip.h:25, from C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\cores\arduino/Arduino.h:42, from sketch\iAqua.ino.cpp:1: C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token #define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */ ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino:52:8: note: in expansion of macro 'RTC' DS3231 RTC; ^ C:\Users\Agedo\AppData\Local\Arduino15\packages\arduino\hardware\sam\1.6.6\system/CMSIS/Device/ATMEL/sam3xa/include/sam3x8e.h:502:29: error: expected ')' before '*' token #define RTC ((Rtc *)0x400E1A60U) /**< \brief (RTC ) Base Address */ ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino:52:8: note: in expansion of macro 'RTC' DS3231 RTC; ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void setup()': iAqua:93: error: request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.begin(); ^ iAqua:95: error: 'DateTime' was not declared in this scope DateTime myTime = RTC.now(); ^ iAqua:95: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:97: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(myTime.unixtime()+3));//для второй компиляции, коррекция РїСЂРё перезагрузках Arduino РЅР° 3 сек. ^ iAqua:97: error: 'myTime' was not declared in this scope RTC.adjust(DateTime(myTime.unixtime()+3));//для второй компиляции, коррекция РїСЂРё перезагрузках Arduino РЅР° 3 сек. ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:127: error: 'DateTime' was not declared in this scope DateTime myTime = RTC.now(); ^ iAqua:127: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:128: error: 'myTime' was not declared in this scope uint32_t UTime = myTime.unixtime(); ^ iAqua:131: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:137: error: expected ';' before 'myTime' DateTime myTime = RTC.now(); ^ iAqua:140: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ exit status 1 request for member 'begin' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > НастройкиПовторюсь:
Попробуйте в 52 строке ( и далее во всём скетче) заменить RTC на myRTC.
Вот первая ошибка:
она следствие объявлеия RTC в 52 строке.
не спасает
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void setup()': iAqua:93: error: 'class DS3231' has no member named 'begin' myRTC.begin(); ^ iAqua:95: error: 'DateTime' was not declared in this scope DateTime myTime = myRTC.now(); ^ iAqua:95: error: expected ';' before 'myTime' DateTime myTime = myRTC.now(); ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:127: error: 'DateTime' was not declared in this scope DateTime myTime = myRTC.now(); ^ iAqua:127: error: expected ';' before 'myTime' DateTime myTime = myRTC.now(); ^ iAqua:128: error: 'myTime' was not declared in this scope uint32_t UTime = myTime.unixtime(); ^ iAqua:129: error: 'nextAdjustTime' was not declared in this scope if (UTime > nextAdjustTime){ ^ iAqua:130: error: 'TimeAdjustPeriod' was not declared in this scope nextAdjustTime = UTime+TimeAdjustPeriod; ^ iAqua:131: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:131: error: 'TimeCorrection' was not declared in this scope RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:137: error: expected ';' before 'myTime' DateTime myTime = myRTC.now(); ^ iAqua:140: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ exit status 1 'class DS3231' has no member named 'begin' Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > НастройкиЕсли это Все ошибки , то именно спасает! Теперь дальше:
Вся работа со временем идет с библиотекой <RTClib.h>, так что раскоментируйте её(сейча Вы используете <DS3231.h>)
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void setup()': iAqua:93: error: 'class DS3231' has no member named 'begin' myRTC.begin(); ^ iAqua:95: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:127: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ iAqua:129: error: 'nextAdjustTime' was not declared in this scope if (UTime > nextAdjustTime){ ^ iAqua:130: error: 'TimeAdjustPeriod' was not declared in this scope nextAdjustTime = UTime+TimeAdjustPeriod; ^ iAqua:131: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:131: error: 'TimeCorrection' was not declared in this scope RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:137: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ iAqua:140: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ iAqua:329: error: 'class DateTime' has no member named 'dayOfWeek' int dow = (myTime.dayOfWeek()); ^ exit status 1 'class DS3231' has no member named 'begin' Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > НастройкиСкетч + ошибки, плииз, покажите опять.
Я надеюсь Вы DS3231.h закомментировали?
Скейтч=)
Ошибка:
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void setup()': iAqua:93: error: 'class DS3231' has no member named 'begin' myRTC.begin(); ^ iAqua:95: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:127: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ iAqua:129: error: 'nextAdjustTime' was not declared in this scope if (UTime > nextAdjustTime){ ^ iAqua:130: error: 'TimeAdjustPeriod' was not declared in this scope nextAdjustTime = UTime+TimeAdjustPeriod; ^ iAqua:131: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:131: error: 'TimeCorrection' was not declared in this scope RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:137: error: 'class DS3231' has no member named 'now' DateTime myTime = myRTC.now(); ^ iAqua:140: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ iAqua:329: error: 'class DateTime' has no member named 'dayOfWeek' int dow = (myTime.dayOfWeek()); ^ exit status 1 'class DS3231' has no member named 'begin' Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > Настройкии так и так пробовал=)
ну теперь еще один шаг - убираем использование DS3231.h:
и так и так пробовал=)
Не перечим - делаем и показываем скетч и ошибки :))
Уже лучше=) скейтч
Ошибка:
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:129: error: 'nextAdjustTime' was not declared in this scope if (UTime > nextAdjustTime){ ^ iAqua:130: error: 'TimeAdjustPeriod' was not declared in this scope nextAdjustTime = UTime+TimeAdjustPeriod; ^ iAqua:131: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:131: error: 'TimeCorrection' was not declared in this scope RTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:140: error: request for member 'adjust' in '1074666080u', which is of pointer type 'Rtc*' (maybe you meant to use '->' ?) RTC.adjust(DateTime(UTime)); ^ iAqua:329: error: 'class DateTime' has no member named 'dayOfWeek' int dow = (myTime.dayOfWeek()); ^ exit status 1 'nextAdjustTime' was not declared in this scope Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > Настройки131
RTC.adjust(DateTime(UTime-TimeCorrection)); - оставили RTC, меняйте. я пока посмотрю другиеубираем комменты в 53, 54, 55 строках.
Не забываем показать скетч и ошибки
Изменил
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:129: error: 'nextAdjustTime' was not declared in this scope if (UTime > nextAdjustTime){ ^ iAqua:130: error: 'TimeAdjustPeriod' was not declared in this scope nextAdjustTime = UTime+TimeAdjustPeriod; ^ iAqua:131: error: 'TimeCorrection' was not declared in this scope myRTC.adjust(DateTime(UTime-TimeCorrection)); ^ iAqua:329: error: 'class DateTime' has no member named 'dayOfWeek' int dow = (myTime.dayOfWeek()); ^ exit status 1 'nextAdjustTime' was not declared in this scope Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > НастройкиСам код:
Arduino: 1.6.7 (Windows 10), Плата:"Arduino Due (Programming Port)" C:\Users\Agedo\Desktop\iAqua\iAqua.ino: In function 'void loop()': iAqua:329: error: 'class DateTime' has no member named 'dayOfWeek' int dow = (myTime.dayOfWeek()); ^ exit status 1 'class DateTime' has no member named 'dayOfWeek' Это сообщение будет содержать больше информации чем "Отображать вывод во время компиляции" включено в Файл > НастройкиЕще лучше=) да Вы бог=)
код
Эту оставлю для Вас :)
спрятана подсказка:
Спасибо огромное изменил в строке название=)
Можно я тогда буду Вас вопросами заваливать? правда не много и не всегда=) мало кто в наше время соглашается помочь=)
мало кто в наше время соглашается помочь
Это Вы как то очень пессимистично настроены. Форум открыт, спецов хватает, так что идущий осилит дорогу! :)