k3ng_rotator_controller
k3ng_rotator_controller copied to clipboard
Help DS3231 & DS3234 RTC
DS3231 is a low-cost, extremely accurate I2C realtime clock (RTC) with an integrated temperature-compensated crystal oscillator (TCXO) and crystal, and tried to implement with this library but it does not read me the device, library from http://www.rinkydinkelectronics.com/library.php?id=73 in compilation I do not create any error but it does not read the i2c of rtc, implemented:
file k3ng_rotator_controller.ino
#ifdef FEATURE_RTC_DS3231 DS3231 rtc(SDA, SCL); // DS3231 rtc(0x57); #endif //FEATURE_RTC_DS3231
#ifdef FEATURE_RTC_DS3231 rtc.begin(); #endif // FEATURE_RTC_DS3231
//EB5HDT #if defined(OPTION_SYNC_RTC_TO_GPS) && defined(FEATURE_RTC_DS3231) static unsigned long last_rtc_gps_sync_time; if ((millis() - last_rtc_gps_sync_time) >= ((unsigned long)SYNC_RTC_TO_GPS_SECONDS * 1000)) { rtc.year = gps_year; rtc.month = gps_month; rtc.day = gps_day; rtc.hour = gps_hours; rtc.minute = gps_minutes; rtc.second = gps_seconds; rtc.set_time(); #ifdef DEBUG_RTC debug.println("service_gps: synced RTC"); #endif // DEBUG_RTC last_rtc_gps_sync_time = millis(); } #endif // defined(OPTION_SYNC_RTC_TO_GPS) && defined(FEATURE_RTC_DS3231)
//EB5HDT
#ifdef FEATURE_RTC_DS3231 if (rtc.isrunning()) { DateTime now = rtc.now(); #ifdef DEBUG_RTC debug.print("service_rtc: syncing: "); debug.print(now.year()); debug.print("/"); debug.print(now.month()); debug.print("/"); debug.print(now.day()); debug.print(" "); debug.print(now.hour()); debug.print(":"); debug.print(now.minute()); debug.print(":"); debug.print(now.second()); debug.println(""); #endif // DEBUG_RTC clock_year_set = now.year(); clock_month_set = now.month(); clock_day_set = now.day(); clock_hour_set = now.hour(); clock_min_set = now.minute(); clock_sec_set = now.second(); millis_at_last_calibration = millis(); update_time(); clock_status = RTC_SYNC; } else { clock_status = FREE_RUNNING; #ifdef DEBUG_RTC debug.println("service_rtc: error: RTC not running"); #endif // DEBUG_RTC } #endif //FEATURE_RTC_DS3231
file rotator_features.ini
#define FEATURE_RTC_DS3231 in the future #define FEATURE_RTC_DS3234
No errors in arduino complier version 1.8.9 but no read the chip via i2c