- Notifications
You must be signed in to change notification settings - Fork4
Open source editor for bitmap images
License
NotificationsYou must be signed in to change notification settings
pkolt/bitmap_editor
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
✨ Open source editor forbitmap images.
👍 Will help you create pictures for librariesU8g2 andAdafruit SSD1306.
If you are using libraryAdafruit SSD1306:
#include<Wire.h>#include<Adafruit_GFX.h>#include<Adafruit_SSD1306.h>#defineSCREEN_WIDTH128// OLED display width, in pixels#defineSCREEN_HEIGHT64// OLED display height, in pixels#defineOLED_RESET -1// Reset pin # (or -1 if sharing Arduino reset pin)#defineSCREEN_ADDRESS0x3C///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32Adafruit_SSD1306display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);#defineBITMAP_WIDTH16#defineBITMAP_HEIGHT16staticconstunsignedchar PROGMEM bitmap[] = {0b00000001,0b00000000,0b00000011,0b10000000,0b00101001,0b00101000,0b00010001,0b00010000,0b00101001,0b00101000,0b00000101,0b01000000,0b01000011,0b10000100,0b11111111,0b11111110,0b01000011,0b10000100,0b00000101,0b01000000,0b00101001,0b00101000,0b00010001,0b00010000,0b00101001,0b00101000,0b00000011,0b10000000,0b00000001,0b00000000,0b00000000,0b00000000 };voidsetup() { Serial.begin(9600);// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internallyif (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) { Serial.println(F("SSD1306 allocation failed"));for (;;) ;// Don't proceed, loop forever } display.clearDisplay(); display.drawBitmap(0,0, bitmap, BITMAP_WIDTH, BITMAP_HEIGHT, SSD1306_WHITE); display.display();}voidloop() {}
If you are using libraryU8g2:
#include<Arduino.h>#include<U8g2lib.h>#include<Wire.h>U8G2_SSD1306_128X64_NONAME_F_HW_I2Cu8g2(U8G2_R0,/* reset=*/U8X8_PIN_NONE);#defineBITMAP_WIDTH16#defineBITMAP_HEIGHT16staticconstunsignedchar PROGMEM bitmap[] = {0b10000000,0b00000000,0b11000000,0b00000001,0b10010100,0b00010100,0b10001000,0b00001000,0b10010100,0b00010100,0b10100000,0b00000010,0b11000010,0b00100001,0b11111111,0b01111111,0b11000010,0b00100001,0b10100000,0b00000010,0b10010100,0b00010100,0b10001000,0b00001000,0b10010100,0b00010100,0b11000000,0b00000001,0b10000000,0b00000000,0b00000000,0b00000000 };voidsetup(void) {pinMode(9, OUTPUT);digitalWrite(9,0);// default output in I2C mode for the SSD1306 test shield: set the i2c adr to 0if (!u8g2.begin()) { Serial.println(F("SSD1306 allocation failed"));for (;;) ;// Don't proceed, loop forever }; u8g2.clearDisplay(); u8g2.drawXBMP(0,0, BITMAP_WIDTH, BITMAP_HEIGHT, bitmap); u8g2.sendBuffer();}voidloop(void) {}
npm cinpm start
For some LCD displays such as the SSD1306, the image width must be a multiple of 8. If this requirement is not met, you will see a wrong image when displayed.
Just use an image width that is a multiple of 8.
About
Open source editor for bitmap images
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.