Skip to content

Instantly share code, notes, and snippets.

@vgheo
Created March 27, 2016 15:51
Show Gist options
  • Save vgheo/e42731c98e279d5eda2e to your computer and use it in GitHub Desktop.
Save vgheo/e42731c98e279d5eda2e to your computer and use it in GitHub Desktop.
arduino rtc compile issues
/*
*
* 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