Skip to content

Instantly share code, notes, and snippets.

@AverageMarcus
Last active August 29, 2015 14:16
Show Gist options
  • Save AverageMarcus/a0a3a801bfffd217ce57 to your computer and use it in GitHub Desktop.
Save AverageMarcus/a0a3a801bfffd217ce57 to your computer and use it in GitHub Desktop.
#include "U8glib.h"
U8GLIB_SSD1306_128X64 u8g(U8G_I2C_OPT_NO_ACK);
#define Egg_width 24
#define Egg_height 25
static unsigned char Egg_bits[] U8G_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x62, 0x00, 0x00, 0xe1, 0x00, 0x80, 0xe3, 0x01, 0x80, 0xe7, 0x01, 0xc0, 0xe7, 0x03, 0xc0, 0xc7, 0x03, 0xe0, 0x87, 0x07, 0xe0, 0x07, 0x04, 0xe0, 0x03, 0x04, 0xe0, 0x03, 0x04, 0xe0, 0x81, 0x07, 0x20, 0xc0, 0x07, 0x40, 0xe0, 0x03, 0x40, 0xe0, 0x03, 0xc0, 0xe1, 0x03, 0xe0, 0xff, 0x07, 0xe0, 0xff, 0x07, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define Egg2_width 24
#define Egg2_height 25
static unsigned char Egg2_bits[] U8G_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0xc3, 0x00, 0x80, 0xc0, 0x01, 0xc0, 0xc1, 0x03, 0xc0, 0xc3, 0x03, 0xe0, 0xc3, 0x07, 0xe0, 0x83, 0x07, 0xf0, 0x03, 0x0f, 0xf0, 0x01, 0x08, 0xf0, 0x00, 0x0f, 0x10, 0x80, 0x0f, 0x20, 0xc0, 0x07, 0x20, 0xc0, 0x07, 0xc0, 0xc0, 0x03, 0xf0, 0xff, 0x0f, 0xf0, 0xff, 0x0f, 0xc0, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define Egg3_width 24
#define Egg3_height 25
static unsigned char Egg3_bits[] U8G_PROGMEM = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x62, 0x00, 0x00, 0xe1, 0x00, 0x80, 0xe3, 0x01, 0x80, 0xe7, 0x01, 0xc0, 0xe7, 0x03, 0xc0, 0xc7, 0x0b, 0xe0, 0x87, 0x07, 0xe8, 0x07, 0x04, 0xe0, 0x47, 0x2c, 0xf0, 0xab, 0x36, 0xe0, 0x11, 0x07, 0x20, 0xc0, 0x07, 0x40, 0xe0, 0x03, 0x40, 0xe0, 0x03, 0xc0, 0xe1, 0x03, 0xe0, 0xff, 0x07, 0xe0, 0xff, 0x07, 0x80, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
#define Egg4_width 30
#define Egg4_height 27
static unsigned char Egg4_bits[] U8G_PROGMEM = { 0x70, 0xc0, 0x81, 0x07, 0xfc, 0xa0, 0x01, 0x09, 0xfa, 0xa0, 0x01, 0x1a, 0xfa, 0xa2, 0x00, 0x1a, 0xf9, 0x60, 0x00, 0x39, 0x71, 0x00, 0x00, 0x3e, 0x31, 0x06, 0x40, 0x38, 0x09, 0x05, 0x00, 0x30, 0x09, 0x03, 0x00, 0x00, 0x05, 0x01, 0x00, 0x08, 0x03, 0x00, 0x00, 0x14, 0x02, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x38, 0xe0, 0x03, 0x00, 0x5c, 0x10, 0x04, 0x08, 0x9c, 0x28, 0x0a, 0x14, 0x9c, 0xc8, 0x09, 0x14, 0xc8, 0xc8, 0x09, 0x0c, 0x70, 0xc8, 0x29, 0x00, 0x00, 0x13, 0x74, 0x00, 0x00, 0xed, 0x7f, 0x02, 0x04, 0x32, 0x3f, 0x00, 0x00, 0x82, 0x3f, 0x00, 0x00, 0x8e, 0x1f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xff, 0x3f, 0x00, 0x00, 0xfc, 0x0f, 0x00 };
#define Egg5_width 24
#define Egg5_height 25
static unsigned char Egg5_bits[] U8G_PROGMEM = { 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, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x80, 0x81, 0x00, 0x40, 0x00, 0x01, 0x40, 0x21, 0x01, 0x20, 0x00, 0x02, 0x20, 0x4e, 0x03, 0x20, 0xa0, 0x02, 0x40, 0x00, 0x02, 0x40, 0x00, 0x02, 0x80, 0x80, 0x01, 0x00, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
int which = 0;
void draw(void) {
if(which < 5){
if ( which % 2 == 0 ){
do {
u8g.drawXBMP( 128/2-(Egg2_width / 2), 64/2-(Egg2_height/2), Egg2_width, Egg2_height, Egg2_bits);
} while( u8g.nextPage() );
}else{
do {
u8g.drawXBMP( 128/2-(Egg_width / 2), 64/2-(Egg_height/2), Egg_width, Egg_height, Egg_bits);
} while( u8g.nextPage() );
}
}else if(which == 5){
do {
u8g.drawXBMP( 128/2-(Egg3_width / 2), 64/2-(Egg3_height/2), Egg3_width, Egg3_height, Egg3_bits);
} while( u8g.nextPage() );
}else if (which == 6){
do {
u8g.drawXBMP( 128/2-(Egg4_width / 2), 64/2-(Egg4_height/2), Egg4_width, Egg4_height, Egg4_bits);
} while( u8g.nextPage() );
}else{
do {
u8g.drawXBMP( 128/2-(Egg5_width / 2), 64/2-(Egg5_height/2), Egg5_width, Egg5_height, Egg5_bits);
} while( u8g.nextPage() );
}
which++;
}
void setup(void) {
}
void loop(void) {
u8g.firstPage();
draw();
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment