Guest User

Untitled

a guest
Nov 1st, 2018
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.00 KB | None | 0 0
  1. #include<Arduino.h>
  2. #include<U8g2lib.h>
  3.  
  4. #ifdef U8X8_HAVE_HW_SPI
  5. #include<SPI.h>
  6. #endif
  7. #ifdef U8X8_HAVE_HW_I2C
  8. #include<Wire.h>
  9. #endif
  10.  
  11. U8G2_SSD1306_128X32_UNIVISION_1_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);   // Adafruit ESP8266/32u4/ARM Boards + FeatherWing OLED
  12.  
  13. // Copy the contents of your .xbm file below
  14. #define michau_width 45
  15. #define michau_height 32
  16. static const unsigned char michau_bits[] PROGMEM = {
  17.    0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x0a, 0xff, 0xff, 0x01, 0xff, 0xff, 0x1f,
  18.    0xaa, 0x2a, 0x00, 0xa8, 0xaa, 0x0a, 0xff, 0x1f, 0x00, 0xf8, 0xff, 0x1f,
  19.    0xaa, 0x0a, 0x00, 0xa0, 0xaa, 0x0a, 0xff, 0x07, 0x00, 0xe0, 0xff, 0x1f,
  20.    0xaa, 0x02, 0x18, 0xa0, 0xaa, 0x0a, 0xff, 0xc3, 0x7f, 0xc0, 0xff, 0x1f,
  21.    0xaa, 0xe2, 0xff, 0x83, 0xaa, 0x0a, 0xff, 0xf3, 0xff, 0x87, 0xff, 0x1f,
  22.    0xaa, 0xf2, 0xff, 0x8f, 0xaa, 0x0a, 0x55, 0xf1, 0xff, 0x0f, 0x55, 0x15,
  23.    0xaa, 0xf0, 0xff, 0x8f, 0xaa, 0x0a, 0x55, 0xfe, 0xff, 0x0f, 0x55, 0x15,
  24.    0xaa, 0xfe, 0xff, 0x8f, 0xaa, 0x0a, 0x55, 0x06, 0xfc, 0x0f, 0x55, 0x15,
  25.    0xaa, 0x06, 0x00, 0x20, 0xaa, 0x0a, 0x55, 0x06, 0x08, 0x60, 0x55, 0x15,
  26.    0xaa, 0x06, 0x1c, 0x30, 0xaa, 0x0a, 0x55, 0x0e, 0x1c, 0x30, 0x55, 0x15,
  27.    0xaa, 0xfc, 0x7f, 0xb8, 0xaa, 0x0a, 0x55, 0xf9, 0xf7, 0x1f, 0x55, 0x15,
  28.    0xaa, 0xfa, 0xe3, 0x87, 0xaa, 0x0a, 0x55, 0xf9, 0xff, 0x57, 0x55, 0x15,
  29.    0xaa, 0xf2, 0x80, 0xa3, 0xaa, 0x0a, 0x55, 0xf5, 0xc1, 0x53, 0x55, 0x15,
  30.    0xaa, 0xe2, 0xff, 0xa9, 0xaa, 0x0a, 0x55, 0xc9, 0xff, 0x55, 0x55, 0x15,
  31.    0xaa, 0x98, 0x7f, 0xa8, 0xaa, 0x0a, 0x55, 0x3c, 0x3f, 0x54, 0x55, 0x15,
  32.    0x02, 0x7c, 0x80, 0xa8, 0xaa, 0x0a, 0x00, 0xfc, 0xff, 0x50, 0x55, 0x15 };
  33.  
  34. void draw(void) {
  35.  // graphic commands to redraw the complete screen should be placed here  
  36.  u8g2.drawXBMP( 0, 0, michau_width, michau_height, michau_bits);
  37. }
  38.  
  39. void setup(void) {
  40.  u8g2.begin();
  41. }
  42.  
  43. void loop(void) {
  44.  // picture loop
  45.  u8g2.firstPage();
  46.  do {
  47.      draw();
  48.     } while( u8g2.nextPage() );
  49.  
  50.  // rebuild the picture after some delay
  51.  delay(1000);
  52. }
Advertisement
Add Comment
Please, Sign In to add comment