ar true soz guys the lib im useing is called PCD8544 so not much help there lol i'll post the bitmap function
full code
#include <Wire.h>
#include <PCD8544.h>
#include "logos.h" //boot time logos
#include <string.h> //Used for string manipulations
#define eeprom1 0x50
#define STRLEN 16
static const byte me2[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80};
char buffer[STRLEN];
int bufferIndex = 0;
static const byte LCD_WIDTH = 84;
static const byte LCD_HEIGHT = 48;
int scrollPosition = -13;
// A custom glyph (a smiley)...
static const byte glyph[] = { B00010000, B00110100, B00110000, B00110100, B00010000 };
static PCD8544 lcd;
void setup() {
// PCD8544-compatible displays may have a different resolution...
lcd.begin(84, 48);
Wire.begin();
Serial.begin(9600);
i2c_eeprom_write_page(eeprom1, 0x0040, (byte*)me, sizeof(me)); // write to EEPROM
delay(10); //add a small delay
boot();
delay(500);
// Add the smiley to position "0" of the ASCII table...
lcd.createChar(0, glyph);
}
void loop() {
// Just to show the program is alive...
static int counter = 0;
// Write a piece of text on the first line...
lcd.setCursor(0, 0);
lcd.print("Hello, World!");
// Write the counter on the second line...
lcd.setCursor(0, 1);
lcd.print(counter, DEC);
lcd.write(' ');
lcd.write(0); // write the smiley
lcd.setCursor(0, 2);
lcd.print("CONSOLE:");
lcd.setCursor(0, 3);
if( Serial.available())
{
char ch = Serial.read();
if( ch == '\r') // is this the terminating carriage return
{
buffer[ bufferIndex ] = 0; // terminate the string with a 0
bufferIndex = 0; // reset the index ready for another string
//lcd.print(" ");
lcd.clearLine();
lcd.print(buffer);
}
else
buffer[ bufferIndex++ ] = ch; // add the character into the buffer
}
Scroll("testing shiz",0,4);
delay(500);
counter++;
}
void boot()
{
int addr=0x0040; //EEPROM Address 0
delay(20); //add a small delay
byte b = i2c_eeprom_read_byte(eeprom1, addr); // access the first address from the memory
lcd.setCursor(0, 0);
delay(20); //add a small delay
while (b!=0) {
//Serial.print((char)b); //print content to serial port
lcd.drawBitmap(b, 84, 38);
addr++; //increase address
b = i2c_eeprom_read_byte(eeprom1, addr); //access an address from the memory
}
delay(3000);
lcd.drawBitmap(me, 84, 38);
delay(3000);
lcd.drawBitmap(JaycarLogo, 84, 38);
delay(3000);
lcd.clear();
delay(500);
}
void Scroll(String message,unsigned char xy,unsigned char yx)
{
lcd.setCursor(xy, yx);
for (int i = scrollPosition; i < scrollPosition + 14; i++)
{
if ((i >= message.length()) || (i < 0))
{
lcd.print(' ');
}
else
{
lcd.print(message.charAt(i));
}
}
scrollPosition++;
if ((scrollPosition >= message.length()) && (scrollPosition > 0))
{
scrollPosition = -13;
}
}
void i2c_eeprom_write_byte( int deviceaddress, unsigned int eeaddress, byte data ) {
int rdata = data;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.write(rdata);
Wire.endTransmission();
}
void i2c_eeprom_write_page( int deviceaddress, unsigned int eeaddresspage, byte* data, byte length ) {
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddresspage >> 8)); // MSB
Wire.write((int)(eeaddresspage & 0xFF)); // LSB
byte c;
for ( c = 0; c < length; c++)
Wire.write(data[c]);
Wire.endTransmission();
}
byte i2c_eeprom_read_byte( int deviceaddress, unsigned int eeaddress ) {
byte rdata = 0xFF;
Wire.beginTransmission(deviceaddress);
Wire.write((int)(eeaddress >> 8)); // MSB
Wire.write((int)(eeaddress & 0xFF)); // LSB
Wire.endTransmission();
Wire.requestFrom(deviceaddress,1);
if (Wire.available()) rdata = Wire.read();
return rdata;
}
drawbitmap
void PCD8544::drawBitmap(const unsigned char *data, unsigned char columns, unsigned char lines)
{
unsigned char scolumn = this->column;
unsigned char sline = this->line;
// The bitmap will be clipped at the right/bottom edge of the display...
unsigned char mx = (scolumn + columns > this->width) ? (this->width - scolumn) : columns;
unsigned char my = (sline + lines > this->height/8) ? (this->height/8 - sline) : lines;
for (unsigned char y = 0; y < my; y++) {
this->setCursor(scolumn, sline + y);
for (unsigned char x = 0; x < mx; x++) {
this->send(PCD8544_DATA, data[y * columns + x]);
}
}
// Leave the cursor in a consistent position...
this->setCursor(scolumn + columns, sline);
}
the full image would look like this
static const byte me[] = {
0xC2, 0x41, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
0x80, 0xC0, 0xC0, 0xF0, 0xF8, 0x38, 0x3E, 0x1A, 0x1F, 0x5F, 0x6F, 0xFF, 0xFF, 0x7F, 0x7F, 0x7F,
0xDF, 0xEF, 0x9F, 0x1F, 0x3F, 0xFF, 0x7F, 0xFF, 0xFE, 0xFE, 0x9D, 0x0F, 0x0F, 0x0F, 0x0B, 0x0F,
0x1F, 0x1F, 0x3F, 0x3F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFC, 0xFC, 0xF8, 0xF0, 0xE0, 0xC0,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20,
0x20, 0xF0, 0xFE, 0xFD, 0xFE, 0xFF, 0xFF, 0xF5, 0x1F, 0x08, 0x48, 0x08, 0x08, 0x28, 0x20, 0x80,
0xE0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x05, 0x67, 0x0E, 0x26, 0x20, 0x28, 0x28, 0x08,
0x08, 0x0C, 0x1C, 0x1A, 0x07, 0x04, 0x00, 0x00, 0x01, 0x00, 0x01, 0xC7, 0xFB, 0xFF, 0x7F, 0x7F,
0x7F, 0xFF, 0xFF, 0x7F, 0xFF, 0xFC, 0xFC, 0xF8, 0xA0, 0x80, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x01, 0x1B, 0x1F, 0x1F, 0x1F, 0x1F, 0x3F, 0x3F, 0xFC, 0xE0, 0xC0, 0x00,
0x00, 0x00, 0x00, 0x83, 0xC0, 0x80, 0x80, 0x80, 0x84, 0x84, 0x88, 0x88, 0x80, 0x80, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x0C, 0x0C, 0xC4, 0x04, 0x01, 0x00,
0x80, 0xE0, 0xE0, 0xF0, 0xD0, 0xF8, 0x3F, 0x1E, 0x1F, 0x1F, 0x1F, 0x1B, 0x17, 0x05, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x07, 0x0F, 0x1E, 0x3C, 0xDC, 0xF7, 0x83, 0x81, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x80, 0x80, 0xC0, 0x40, 0x40, 0x60, 0x20, 0x10, 0x10, 0x08, 0x0C, 0x04, 0x06, 0x03, 0x03,
0x01, 0x80, 0xC0, 0xF8, 0xFF, 0x7F, 0x3F, 0x3F, 0x13, 0x11, 0x10, 0x00, 0x00, 0x00, 0x30, 0x30,
0x30, 0x38, 0x38, 0x38, 0x3C, 0x3C, 0x3C, 0x3C, 0x3E, 0x3E, 0x3E, 0x3C, 0x7C, 0x7C, 0xFC, 0xF8,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x80, 0x00, 0x01, 0x03, 0x03, 0x07, 0x87,
0xCD, 0x2F, 0x3B, 0x34, 0x08, 0x18, 0x18, 0x1C, 0x1E, 0x0C, 0x08, 0x00, 0x40, 0x20, 0x20, 0x10,
0x08, 0x0C, 0x86, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x01, 0x03, 0xC4, 0x84, 0x84, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00,
0x00, 0x00, 0x88, 0xE8, 0xE8, 0xF8, 0xF8, 0x78, 0xFF, 0x1F, 0x1F, 0x0F, 0x03, 0x01, 0x00, 0x00,
0x00, 0x5C, 0x84, 0x83, 0xE0, 0x50, 0x70, 0xF0, 0xF0, 0xCC, 0x04, 0x02, 0x02, 0x01, 0x00, 0x00,
0x00, 0x04, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x20, 0xF0, 0xF0, 0xFC, 0xF8, 0xE4, 0x24, 0x0C, 0x06, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00,
0x00, 0x80, 0x80, 0x40, 0xE0, 0xF0, 0xF8, 0xFC,
};