72 lines
2.1 KiB
C++
72 lines
2.1 KiB
C++
#include <Adafruit_SSD1306.h>
|
|
|
|
static const unsigned char PROGMEM image_window[] = {
|
|
0x7f, 0x80, 0x7e, 0x80, 0x7f, 0x80, 0x40, 0x80,
|
|
0xfe, 0x80, 0x82, 0x80, 0x83, 0x80, 0xfe, 0x00};
|
|
static const unsigned char PROGMEM image_devil[] = {
|
|
0x30, 0x03, 0x00, 0x60, 0x01, 0x80, 0xe0, 0x01, 0xc0, 0xf3, 0xf3,
|
|
0xc0, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xc0, 0x7f, 0xff, 0x80, 0x7f,
|
|
0xff, 0x80, 0x7f, 0xff, 0x80, 0xef, 0xfd, 0xc0, 0xe7, 0xf9, 0xc0,
|
|
0xe3, 0xf1, 0xc0, 0xe1, 0xe1, 0xc0, 0xf1, 0xe3, 0xc0, 0xff, 0xff,
|
|
0xc0, 0x7f, 0xff, 0x80, 0x7b, 0xf7, 0x80, 0x3d, 0x2f, 0x00, 0x1e,
|
|
0x1e, 0x00, 0x0f, 0xfc, 0x00, 0x03, 0xf0, 0x00};
|
|
static const unsigned char PROGMEM image_loading[] = {
|
|
0x03, 0xf0, 0x00, 0x0f, 0xfc, 0x00, 0x1f, 0xfe, 0x00, 0x38, 0x07,
|
|
0x00, 0x7d, 0xef, 0x80, 0x7d, 0xef, 0x80, 0xfd, 0xef, 0xc0, 0xfe,
|
|
0xdf, 0xc0, 0xff, 0x3f, 0xc0, 0xff, 0x3f, 0xc0, 0xfe, 0x9f, 0xc0,
|
|
0xfd, 0x4f, 0xc0, 0x7c, 0xaf, 0x80, 0x7d, 0x4f, 0x80, 0x38, 0x07,
|
|
0x00, 0x1f, 0xfe, 0x00, 0x0f, 0xfc, 0x00, 0x03, 0xf0, 0x00};
|
|
|
|
Adafruit_SSD1306 display(128, 64, &Wire, 4);
|
|
|
|
unsigned int COUNT;
|
|
|
|
void setup() {
|
|
COUNT = 0;
|
|
|
|
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
|
|
display.clearDisplay();
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
display.setTextSize(1);
|
|
display.setCursor(39, 26);
|
|
display.setTextWrap(false);
|
|
display.print("Loading...");
|
|
display.drawBitmap(16, 21, image_loading, 18, 18, 1);
|
|
|
|
display.display();
|
|
delay(1000);
|
|
}
|
|
|
|
void loop() {
|
|
display.clearDisplay();
|
|
display.setTextColor(SSD1306_WHITE);
|
|
|
|
display.drawRect(0, 0, 128, 51, 1);
|
|
display.drawRect(0, 50, 128, 14, 1);
|
|
|
|
display.drawBitmap(6, 24, image_devil, 18, 21, 1);
|
|
display.drawBitmap(5, 53, image_window, 9, 8, 1);
|
|
|
|
display.setTextSize(1);
|
|
display.setCursor(17, 53);
|
|
display.setTextWrap(false);
|
|
display.print("by Alexander Popov");
|
|
|
|
display.setCursor(31, 23);
|
|
display.setTextWrap(false);
|
|
display.print("count:");
|
|
|
|
display.setTextSize(2);
|
|
display.setCursor(6, 5);
|
|
display.setTextWrap(false);
|
|
display.print("Brake");
|
|
|
|
display.setTextSize(3);
|
|
display.setCursor(71, 9);
|
|
display.setTextWrap(false);
|
|
display.print(COUNT);
|
|
|
|
display.display();
|
|
}
|