2024-12-0600 SD Karte eingebunden.
This commit is contained in:
parent
39d95a13cc
commit
628173b129
BIN
include/FOLYWLIJEOILQ5U.webp
Normal file
BIN
include/FOLYWLIJEOILQ5U.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 204 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 MiB |
|
@ -13,8 +13,8 @@ platform = espressif32
|
|||
board = lolin32
|
||||
framework = arduino
|
||||
monitor_speed=115200
|
||||
;monitor_filters=time
|
||||
monitor_filters=time
|
||||
lib_deps =
|
||||
# The exact version
|
||||
adafruit/Adafruit MAX31865 library @ 1.6.2
|
||||
adafruit/Adafruit SSD1306 @ 2.5.13
|
||||
adafruit/Adafruit SSD1306 @ 2.5.13
|
||||
|
|
64
src/main.cpp
64
src/main.cpp
|
@ -42,11 +42,14 @@ 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>
|
||||
#include <WiFi.h>
|
||||
#include <SD.h>
|
||||
|
||||
|
||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
|
||||
|
@ -57,6 +60,15 @@ Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);
|
|||
|
||||
#define NUMFLAKES 10 // Number of snowflakes in the animation example
|
||||
|
||||
#define chipSelect 4
|
||||
|
||||
#define SD_SCK 14
|
||||
#define SD_MISO 12
|
||||
#define SD_MOSI 13
|
||||
#define SD_CS 27
|
||||
|
||||
|
||||
|
||||
const char* ssid = "MagentaWLAN-RGDO";
|
||||
const char* password = "93329248424922704583";
|
||||
const char* NTP_SERVER = "de.pool.ntp.org";
|
||||
|
@ -67,6 +79,8 @@ time_t now;
|
|||
long unsigned lastNTPtime;
|
||||
unsigned long lastEntryTime;
|
||||
|
||||
File myFile;
|
||||
|
||||
char szZeit[20];
|
||||
|
||||
bool getNTPtime(int sec) {
|
||||
|
@ -122,6 +136,16 @@ void blink(){
|
|||
digitalWrite (LED_Blue, HIGH);
|
||||
delay(100);
|
||||
digitalWrite (LED_Blue, !HIGH);
|
||||
}
|
||||
|
||||
void blinkError(){
|
||||
digitalWrite (LED_Blue, HIGH);
|
||||
delay(50);
|
||||
digitalWrite (LED_Blue, !HIGH);
|
||||
delay(50);
|
||||
digitalWrite (LED_Blue, HIGH);
|
||||
delay(50);
|
||||
digitalWrite (LED_Blue, !HIGH);
|
||||
}
|
||||
|
||||
void drawIST(float wert){
|
||||
|
@ -155,7 +179,16 @@ void drawIST(float wert){
|
|||
|
||||
void setup() {
|
||||
Serial.begin(115200);
|
||||
//pinMode (chipSelect, OUTPUT);
|
||||
pinMode (LED_Blue, OUTPUT);
|
||||
/* while (!Serial) {
|
||||
|
||||
|
||||
; // wait for serial port to connect. Needed for native USB port only
|
||||
|
||||
|
||||
}
|
||||
*/
|
||||
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
||||
Serial.println(F("SSD1306 allocation failed"));
|
||||
|
@ -165,7 +198,18 @@ void setup() {
|
|||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||
display.ssd1306_command(8);
|
||||
|
||||
delay(1000);
|
||||
delay(50);
|
||||
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
|
||||
|
||||
Serial.println("Wait to Wlan.");
|
||||
display.println("Start.");
|
||||
display.setTextSize(2);
|
||||
display.println("Wait to Wlan.");
|
||||
display.display();
|
||||
|
||||
WiFi.begin(ssid, password);
|
||||
while (WiFi.status() != WL_CONNECTED) {
|
||||
delay(500);
|
||||
|
@ -173,18 +217,28 @@ void setup() {
|
|||
}
|
||||
Serial.printf("\nConnecting to %s\n", ssid);
|
||||
|
||||
|
||||
|
||||
if(!SD.begin(SD_CS)){
|
||||
Serial.println("SD-Card not connected!");
|
||||
while(1){
|
||||
blinkError();
|
||||
};
|
||||
}
|
||||
else{
|
||||
Serial.println("SD-Card initialized");
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 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.setCursor(0,0);
|
||||
display.println("--PT1000--");
|
||||
//display.display();
|
||||
|
||||
pinMode (LED_Blue, OUTPUT);
|
||||
digitalWrite (LED_Blue, HIGH);
|
||||
//digitalWrite (LED_Blue, HIGH);
|
||||
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
|
||||
|
||||
thermo.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
|
||||
|
|
Loading…
Reference in New Issue
Block a user