Created
March 27, 2016 15:51
-
-
Save vgheo/e42731c98e279d5eda2e to your computer and use it in GitHub Desktop.
arduino rtc compile issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* | |
* Build on | |
* Arduino 1.6.7 | |
* Adafruit RTClib | |
* ... | |
*/ | |
#include <Wire.h> | |
#include <Adafruit_LEDBackpack.h> | |
#include <Adafruit_GFX.h> | |
#include <RTClib.h> | |
RTC_DS1307 RTC; | |
Adafruit_7segment disp = Adafruit_7segment(); | |
void setup() | |
{ | |
Wire.begin(); | |
RTC.begin(); | |
if (! RTC.isrunning()) | |
{ | |
RTC.adjust(DateTime(__DATE__, __TIME__)); | |
} | |
disp.begin(0x70); | |
} | |
void loop() | |
{ | |
disp.print(getDecimalTime()); | |
disp.drawColon(true); | |
disp.writeDisplay(); | |
delay(500); | |
disp.drawColon(false); | |
disp.writeDisplay(); | |
delay(500); | |
} | |
int getDecimalTime() | |
{ | |
DateTime now = RTC.now(); | |
int decimalTime = now.hour() + now.minute(); | |
return decimalTime; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment