#include "Adafruit_LEDBackpack.h"
to
#include "Adafruit_LEDBackpack_I2cLib.h"
In Adafruit_LEDBackpack_I2cLib.cpp I made the same #include change.
But I'm getting this error:
no matching function for call to 'Adafruit_GFX::Adafruit_GFX(int, int)'
I figure I'm doing something wrong with how I've got the library organized, but I can't figure out what.
Below are the include statements from each file. Attached are the Adafruit_LEDBackpack_I2cLib files.
LED_Display.ino
Code: Select all
#include <Wire.h> // Used for I2C
#include "RTClib.h" // http://github.com/adafruit/RTClib
//#include "Adafruit_LEDBackpack.h" // http://github.com/adafruit/Adafruit-LED-Backpack-Library - try to rewrite without wire.h
#include "Adafruit_LEDBackpack_I2cLib.h"
#include "Adafruit_GFX.h" // http://github.com/adafruit/Adafruit-GFX-Library
Code: Select all
#include <Wire.h>
#include "Adafruit_GFX.h"
#include "Adafruit_LEDBackpack_I2cLib.h"
Code: Select all
#include "Arduino.h"
#include "Wire.h"
#include "Adafruit_GFX.h"
Here's my .ino file. I can't attach it because if the 3 file limit
Code: Select all
#include <Wire.h> // Used for I2C
#include "RTClib.h" // http://github.com/adafruit/RTClib
//#include "Adafruit_LEDBackpack.h" // http://github.com/adafruit/Adafruit-LED-Backpack-Library - try to rewrite without wire.h
#include "Adafruit_LEDBackpack_I2cLib.h"
#include "Adafruit_GFX.h" // http://github.com/adafruit/Adafruit-GFX-Library
Adafruit_7segment matrix = Adafruit_7segment();
#define PCBLED 13 // PCB LED
uint32_t lcdRefreshTimer; // Update LCD every second
RTC_DS1307 RTC;
//--------------------------------------------------------------------------------------------------------
void setup()
{
Serial.begin(9600);
pinMode(PCBLED, OUTPUT);
digitalWrite(PCBLED, LOW);
Wire.begin(); // Join the bus as a master
RTC.begin();
matrix.begin(0x70); // enable LED display
lcdRefreshTimer = millis() + 1000; // start the refresh timer - update every second
}
//--------------------------------------------------------------------------------------------------------
void loop()
{
// display time
if((long)(millis() - lcdRefreshTimer) < 0)
{
updateLcdDisplay();
lcdRefreshTimer = millis() + 1000;
}
}
//--------------------------------------------------------------------------------------------------------
// Update LCD display with the current time
void updateLcdDisplay()
{
int dispTime;
uint8_t brightness;
DateTime now = RTC.now();
// Set brightness based on hour of the day
// Range 1 - 100
if (now.hour() >= 20 || now.hour() <= 6)
{ brightness = 1; } // Night time
else
{ brightness = 25; } // Daytime
if(now.hour() == 0)
{dispTime = 1200 + now.minute();} // Midnight
else if (now.hour() > 12)
{dispTime = (now.hour() - 12) * 100 + now.minute();} // PM
else
{dispTime = now.hour() * 100 + now.minute();} // AM (between 1:00 AM and noon)
matrix.clear();
matrix.println(dispTime); // Send time to display
matrix.setBrightness(brightness);
matrix.drawColon(true); // enable colon
matrix.writeDisplay(); // refresh display with the time
}