#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
/* Uncomment the initialize the I2C address , uncomment only one, If you get a totally blank screen try the other*/
#define i2c_Address 0x3c //initialize with the I2C addr 0x3C Typically eBay OLED's
//#define i2c_Address 0x3d //initialize with the I2C addr 0x3D Typically Adafruit OLED's
#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET -1 // QT-PY / XIAO
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
// 'bateria', 16x7px
const unsigned char epd_bitmap_bateria [] PROGMEM = {
0xff, 0xfc, 0x80, 0x07, 0x9b, 0x61, 0x9b, 0x61, 0x9b, 0x61, 0x80, 0x07, 0xff, 0xfc
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmap_allArray_LEN = 1;
const unsigned char* epd_bitmap_allArray[1] = {
epd_bitmap_bateria
};
// 'sinal', 16x7px
const unsigned char epd_bitmap_sinal [] PROGMEM = {
0xfe, 0x00, 0xc6, 0x01, 0x6c, 0x05, 0x38, 0x15, 0x10, 0x55, 0x11, 0x55, 0x11, 0x55
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmapsinal_allArray_LEN = 1;
const unsigned char* epd_bitmapsinal_allArray[1] = {
epd_bitmap_sinal
};
// 'nosinal3', 16x7px
const unsigned char epd_bitmap_nosinal3 [] PROGMEM = {
0xfe, 0x41, 0xc6, 0x22, 0x6c, 0x14, 0x38, 0x08, 0x10, 0x14, 0x10, 0x22, 0x10, 0x41
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmap_nosinal3allArray_LEN = 1;
const unsigned char* epd_bitmap_nosinal3allArray[1] = {
epd_bitmap_nosinal3
};
// 'nosinal', 16x7px
const unsigned char epd_bitmap_nosinalnosinal [] PROGMEM = {
0x84, 0x00, 0x48, 0x01, 0x30, 0x05, 0x30, 0x15, 0x48, 0x55, 0x85, 0x55, 0x01, 0x55
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmap_nosinalallArray_LEN = 1;
const unsigned char* epd_bitmap_nosinalallArray[1] = {
epd_bitmap_nosinalnosinal
};
// 'gps2', 23x7px
const unsigned char epd_bitmap_gps2 [] PROGMEM = {
0x7e, 0x00, 0xfc, 0xdb, 0x39, 0xb6, 0xdb, 0x7d, 0xb6, 0xdb, 0xff, 0xb6, 0xdb, 0x7d, 0xb6, 0xdb,
0x39, 0xb6, 0x7e, 0x00, 0xfc
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 48)
const int epd_bitmap_gps2allArray_LEN = 1;
const unsigned char* epd_bitmap_gps2allArray[1] = {
epd_bitmap_gps2
};
// 'noSD', 11x7px
const unsigned char epd_bitmap_noSD [] PROGMEM = {
0xff, 0x00, 0xbb, 0x80, 0xd7, 0xc0, 0xef, 0xe0, 0xd7, 0xe0, 0xbb, 0xe0, 0xff, 0xe0
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmapnosd_allArray_LEN = 1;
const unsigned char* epd_bitmapnosd_allArray[1] = {
epd_bitmap_noSD
};
// 'SD', 11x7px
const unsigned char epd_bitmap_SD [] PROGMEM = {
0xff, 0x00, 0xc9, 0x80, 0xba, 0xc0, 0xda, 0xe0, 0xea, 0xe0, 0x99, 0xe0, 0xff, 0xe0
};
// Array of all bitmaps for convenience. (Total bytes used to store images in PROGMEM = 32)
const int epd_bitmapsd_allArray_LEN = 1;
const unsigned char* epd_bitmapsd_allArray[1] = {
epd_bitmap_SD
};
void setup() {
Serial.begin(9600);
// Show image buffer on the display hardware.
// Since the buffer is intialized with an Adafruit splashscreen
// internally, this will display the splashscreen.
delay(250); // wait for the OLED to power up
display.begin(i2c_Address, true); // Address 0x3C default
display.setContrast (100); // dim display
// Show initial display buffer contents on the screen --
// the library initializes this with an Adafruit splash screen.
display.display();
// delay(2000); // Pause for 2 seconds
display.setTextColor(SH110X_WHITE);
// Quando entra o modo config
display.clearDisplay();
display.drawBitmap(0, 0, epd_bitmap_bateria, 16, 7, 1);
display.drawBitmap(20, 0, epd_bitmap_sinal, 16, 7, 1);
display.drawBitmap(40, 0, epd_bitmap_nosinalnosinal, 16, 7, 1);
display.drawBitmap(60, 0, epd_bitmap_nosinal3, 16, 7, 1);
display.drawBitmap(80, 0, epd_bitmap_noSD, 11, 7, 1);
display.drawBitmap(95, 0, epd_bitmap_SD, 11, 7, 1);
display.drawBitmap(0, 10, epd_bitmap_SD, 11, 7, 1);
display.drawBitmap(20, 10, epd_bitmap_noSD, 11, 7, 1);
display.drawBitmap(50, 10, epd_bitmap_sinal, 16, 7, 1);
display.drawBitmap(70, 10, epd_bitmap_nosinal3, 16, 7, 1);
display.drawBitmap(90, 10, epd_bitmap_bateria, 16, 7, 1);
display.drawBitmap(0, 30, epd_bitmap_gps2, 23, 7, 1);
display.setTextSize(1);
display.setCursor(108,10);
display.println("30%");
display.setTextSize(1);
display.setCursor(30,0);
// display.println("Modo Ajuste");
display.setCursor(50,20);
display.setTextSize(2);
display.println("Ar");
display.setTextSize(1);
display.setCursor(0,45);
display.println("Pressione o botao com o sensor sobre o ar.");
display.display();
/*
delay(2000);
// assim que pressiona o botão ar
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(20,30);
display.setTextSize(1);
display.println("Ajustando Ar...");
display.display();
delay(2000);
/// quando ocorre o retorno pelo instrumento
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(40,20);
display.setTextSize(2);
display.println("1,0");
display.setCursor(20,45);
display.setTextSize(1);
display.println("Er Ar ajustado.");
display.display();
delay(2000);
// após um delay er ajustado
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(40,20);
display.setTextSize(2);
display.println("Agua");
display.setTextSize(1);
display.setCursor(0,45);
display.println("Pressione o botao com o sensor na agua.");
display.display();
delay(2000);
/// quando pressiona agua
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(20,30);
display.setTextSize(1);
display.println("Ajustando Agua...");
display.display();
delay(2000);
//quando recebe sensor agua
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(40,20);
display.setTextSize(2);
display.println("80,0");
display.setCursor(15,45);
display.setTextSize(1);
display.println("Er Agua ajustado.");
display.display();
// colocar um delay
delay(2000);
display.clearDisplay();
display.setCursor(30,1);
display.println("Modo Ajuste");
display.setCursor(5,25);
display.setTextSize(1);
display.println("Ajuste realizado com sucesso.");
display.display();
*/
}
void loop() {
}