WaGi-Coding

test1

Mar 4th, 2021
841
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <SPI.h>
  2. #include <Wire.h>
  3. //#include <Adafruit_GFX.h>
  4. #include <Adafruit_SSD1306.h>
  5.  
  6. #define SCREEN_WIDTH 72 // OLED display width, in pixels
  7. #define SCREEN_HEIGHT 40 // OLED display height, in pixels
  8.  
  9. // Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
  10. // The pins for I2C are defined by the Wire-library.
  11. // On an arduino UNO:       A4(SDA), A5(SCL)
  12. // On an arduino MEGA 2560: 20(SDA), 21(SCL)
  13. // On an arduino LEONARDO:   2(SDA),  3(SCL), ...
  14. #define OLED_RESET     -1 // Reset pin # (or -1 if sharing Arduino reset pin)
  15. #define SCREEN_ADDRESS 0x3C ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
  16. Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
  17.  
  18. // ACHTUNG Zeichen
  19. static const unsigned char my_bmp[] PROGMEM = {
  20.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  21.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80,
  22.   0x80, 0xc0, 0x40, 0x60, 0x20, 0x30, 0x10, 0x18, 0x08, 0x0c, 0x04, 0x06, 0xfe, 0x00, 0x00, 0x00,
  23.   0x00, 0x00, 0x00, 0x00, 0x18, 0xa4, 0xa4, 0x9c, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  24.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  25.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0xc0, 0x40, 0x60, 0x20, 0x30, 0x10, 0x18,
  26.   0x08, 0x0c, 0x04, 0x06, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  27.   0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x2b, 0x2c, 0x68, 0xa8,
  28.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  29.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x24, 0x66, 0x42, 0xc3, 0x81, 0x81,
  30.   0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x66, 0x24, 0x24, 0x24,
  31.   0x24, 0x24, 0x3c, 0x00, 0x7e, 0x81, 0x81, 0x81, 0x81, 0x81, 0x7e, 0x00, 0xff, 0x00, 0x00, 0x00,
  32.   0x00, 0x00, 0x20, 0x20, 0x7a, 0x22, 0x22, 0x19, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  33.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  34.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x02, 0x06, 0x04, 0x0c, 0x08, 0x18,
  35.   0x10, 0x30, 0x20, 0x60, 0x40, 0xc0, 0x80, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  36.   0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, 0x6e, 0x89, 0x89, 0x69,
  37.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  38.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  39.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01,
  40.   0x01, 0x03, 0x02, 0x06, 0x04, 0x0c, 0x08, 0x18, 0x10, 0x30, 0x20, 0x60, 0x7f, 0x00, 0x00, 0x00,
  41.   0x00, 0x00, 0x0c, 0x12, 0x12, 0x1e, 0x12, 0x12, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  42.   0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
  43. };
  44.  
  45. void setup() {
  46.   Serial.begin(9600);
  47.  
  48.   // SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
  49.   if(!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
  50.     Serial.println(F("SSD1306 allocation failed"));
  51.     for(;;); // Don't proceed, loop forever
  52.   }
  53.  
  54.   // Show initial display buffer contents on the screen --
  55.   // the library initializes this with an Adafruit splash screen.
  56.   display.display();
  57.   //delay(2000); // Pause for 2 seconds
  58.  
  59.   // Clear the buffer
  60.   display.clearDisplay();
  61.  
  62.   testdrawbitmap();    // Draw a small bitmap image
  63. }
  64.  
  65. void loop() {
  66. }
  67.  
  68. void testdrawbitmap(void) {
  69.   display.clearDisplay();
  70.   display.drawBitmap(0,0,my_bmp, 72, 40, 1);
  71.   display.display();
  72.   delay(1000);
  73. }
  74.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×