#include <Adafruit_SSD1306.h>
#include <Wire.h>
Adafruit_SSD1306 display(128, 64, &Wire, -1);
const unsigned char L_flow [] PROGMEM = {
0x38, 0x00, 0x44, 0x10, 0x82, 0x10, 0x81, 0x20, 0x00, 0xc0, 0x38, 0x00, 0x44, 0x10, 0x82, 0x10,
0x81, 0x20, 0x00, 0xc0
};
const unsigned char L_waktu [] PROGMEM = {
0x0c, 0x00, 0x33, 0x00, 0x40, 0x80, 0x42, 0x80, 0x84, 0x40, 0x88, 0x40, 0x40, 0x80, 0x40, 0x80,
0x33, 0x00, 0x0c, 0x00
};
const unsigned char L_tinggi [] PROGMEM = {
0x10, 0x20, 0x10, 0x70, 0x38, 0xa8, 0x38, 0x20, 0x7c, 0x20, 0xfe, 0x20, 0xf6, 0x20, 0x6c, 0xa8,
0x7c, 0x70, 0x10, 0x20
};
void setup() {
// put your setup code here, to run once:
Wire.begin(-1, -1);
Serial.begin(115200);
if (!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
Serial.println(F("SSD1306 allocation failed"));
for (;;);
}
//display.display(); // Tampilkan splash screen (default) sementara
// Tunggu sebentar dan hapus splash screen
//delay(2000);
display.clearDisplay();
}
void updateDisplay() {
display.clearDisplay();
display.setTextColor(WHITE);
display.setTextSize(1);
display.setFont(NULL);
display.setCursor(2, 2);
display.println("MONITORING TANDON AIR");
display.drawLine(5, 11, 123, 11, 1);
display.drawRoundRect(2, 22, 24, 29, 3, 1);
display.fillRoundRect(5, 19, 18, 3, 3, 1);
display.setTextSize(1);
display.fillRect(4, 29, 20, 20, 1);
display.setCursor(3, 54);
display.print("100%");
display.drawBitmap(36, 19, L_flow, 12, 10, WHITE);
display.drawBitmap(37, 35, L_waktu, 10, 10, WHITE);
display.drawBitmap(36, 51, L_tinggi, 13, 10, WHITE);
display.setCursor(55, 20);
display.print("5 L/j");
display.setCursor(55, 36);
display.print("20 m");
display.setCursor(55, 52);
display.print("1 m");
display.display();
}
void loop() {
// put your main code here, to run repeatedly:
/*display.setTextSize(1); // Ukuran teks
display.setTextColor(SSD1306_WHITE); // Warna teks
display.setCursor(0,0); // Koordinat awal teks (x, y)
display.clearDisplay(); // Bersihkan layar
display.print(F("MONITORING TANDON AIR")); // Teks yang akan ditampilkan
display.display(); // Tampilkan teks
// Tambahkan penundaan atau sesuaikan sesuai kebutuhan
delay(2000);*/
updateDisplay();
delay(2000);
}