2024-10-2900 OLED
This commit is contained in:
parent
8b1e91e8cb
commit
1c4a140443
|
@ -16,4 +16,5 @@ monitor_speed=115200
|
|||
lib_deps =
|
||||
# The exact version
|
||||
adafruit/Adafruit MAX31865 library @ 1.6.2
|
||||
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||
adafruit/Adafruit Unified Sensor @ 1.1.14
|
||||
adafruit/Adafruit SSD1306 @ 2.5.12
|
64
src/main.cpp
64
src/main.cpp
|
@ -42,8 +42,61 @@ Adafruit_MAX31865 thermo = Adafruit_MAX31865(5, 23, 19, 18);
|
|||
|
||||
int LED_Blue = 2;
|
||||
|
||||
#include <SPI.h>
|
||||
#include <Wire.h>
|
||||
#include <Adafruit_GFX.h>
|
||||
#include <Adafruit_SSD1306.h>
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||
|
||||
// Declaration for an SSD1306 display connected to I2C (SDA, SCL pins)
|
||||
#define OLED_RESET -1 // Reset pin # (or -1 if sharing Arduino reset pin)
|
||||
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
||||
|
||||
#define NUMFLAKES 10 // Number of snowflakes in the animation example
|
||||
|
||||
void drawIST(float wert){
|
||||
char msgt[20];
|
||||
String mw;
|
||||
dtostrf(wert, 6, 2, msgt);
|
||||
mw = msgt;
|
||||
display.clearDisplay();
|
||||
display.setCursor(0,0); // Start at top-left corner
|
||||
display.println("--PT1000--");
|
||||
display.setCursor(0,32); // Zeile 2
|
||||
display.setTextSize(1);
|
||||
display.setTextColor(WHITE);
|
||||
display.println("Temperatur:");
|
||||
display.setCursor(20,48); // Zeile 3
|
||||
display.setTextSize(2);
|
||||
mw.replace('.',',');
|
||||
display.print(mw);
|
||||
display.setTextSize(1);
|
||||
display.print(" o");
|
||||
display.setTextSize(2);
|
||||
display.println("C");
|
||||
display.display();
|
||||
}
|
||||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
for(;;); // Don't proceed, loop forever
|
||||
}
|
||||
display.display();
|
||||
delay(2000); // Pause for 2 seconds
|
||||
|
||||
// Clear the buffer
|
||||
display.clearDisplay();
|
||||
display.setTextSize(2); // Normal 1:1 pixel scale
|
||||
display.setTextColor(WHITE); // Draw white text
|
||||
display.setCursor(0,0); // Start at top-left corner
|
||||
display.println("--PT1000--");
|
||||
display.display();
|
||||
|
||||
pinMode (LED_Blue, OUTPUT);
|
||||
digitalWrite (LED_Blue, HIGH);
|
||||
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
|
||||
|
@ -62,6 +115,17 @@ void loop() {
|
|||
Serial.print("Resistance = "); Serial.println(RREF*ratio,8);
|
||||
Serial.print("Temperature = "); Serial.println(thermo.temperature(RNOMINAL, RREF));
|
||||
|
||||
/* display.clearDisplay();
|
||||
display.setCursor(0,0); // Start at top-left corner
|
||||
display.println("--PT1000--");
|
||||
display.setCursor(0,32); // Start at top-left corner
|
||||
display.println(thermo.temperature(RNOMINAL, RREF));
|
||||
display.display(); */
|
||||
|
||||
drawIST(thermo.temperature(RNOMINAL, RREF));
|
||||
|
||||
|
||||
|
||||
// Check and print any faults
|
||||
uint8_t fault = thermo.readFault();
|
||||
if (fault) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user