Help moving Adafruit_LEDBackpack Library

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
scott216
 
Posts: 163
Joined: Sun Apr 12, 2009 11:08 am

Help moving Adafruit_LEDBackpack Library

Post by scott216 »

For I2C communicate to my LED backpack, I want to use a library other then wire.h. I plan to make changes to Adafruit_LEDBackpack.cpp but haven't yet. To do this I moved Adafruit_LEDBackpack.h and .cpp to the same directory my .ino file is in and I renamed the two files to Adafruit_LEDBackpack_I2cLib.h and .cpp. I left Adafruit_GFX.h and .cpp alone. In my sketch I changed
#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
Adafruit_LEDBackpack_I2cLib.cpp

Code: Select all

#include <Wire.h>
#include "Adafruit_GFX.h"
#include "Adafruit_LEDBackpack_I2cLib.h"
Adafruit_LEDBackpack_I2cLib.h

Code: Select all

#include "Arduino.h"
#include "Wire.h"
#include "Adafruit_GFX.h"
Screenshot of tabs in IDE
Screenshot of tabs in IDE
Screen Shot 2013-08-03 at 10.45.55 AM.png (19.64 KiB) Viewed 410 times

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  
  
}  
Attachments
Adafruit_LEDBackpack_I2cLib.h
(2.95 KiB) Downloaded 173 times
Adafruit_LEDBackpack_I2cLib.cpp
(7.61 KiB) Downloaded 153 times

Locked
Please be positive and constructive with your questions and comments.

Return to “Arduino”