Files
arduino/OLED_BOLT_copy_20240606191658/OLED_BOLT_copy_20240606191658.ino
2025-10-12 09:13:56 +02:00

45 lines
1.0 KiB
C++

#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SH110X.h>
#define i2c_Address 0x3C // Change this if your OLED has a different I2C address
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define OLED_RESET -1
Adafruit_SH1106G display = Adafruit_SH1106G(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
void setup() {
Serial.begin(9600);
if(!display.begin(i2c_Address)) {
Serial.println(F("SH110X allocation failed"));
for(;;);
}
display.display();
delay(2000);
display.clearDisplay();
}
void loop() {
display.clearDisplay();
display.setTextSize(1);
display.setTextColor(SH110X_WHITE);
// Display temperature on the screen in Celsius with one decimal place
display.setCursor(10, 10);
display.print("Temp:");
display.setCursor(40, 10);
display.print("-127.00"); // Display one decimal place
display.setCursor(10, 20);
display.print("Fan%:");
display.setCursor(40, 20);
display.print("44");
// Update the display
display.display();
}