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,7 +13,7 @@ platform = espressif32
|
||||||
board = lolin32
|
board = lolin32
|
||||||
framework = arduino
|
framework = arduino
|
||||||
monitor_speed=115200
|
monitor_speed=115200
|
||||||
;monitor_filters=time
|
monitor_filters=time
|
||||||
lib_deps =
|
lib_deps =
|
||||||
# The exact version
|
# The exact version
|
||||||
adafruit/Adafruit MAX31865 library @ 1.6.2
|
adafruit/Adafruit MAX31865 library @ 1.6.2
|
||||||
|
|
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;
|
int LED_Blue = 2;
|
||||||
|
|
||||||
|
|
||||||
#include <SPI.h>
|
#include <SPI.h>
|
||||||
#include <Wire.h>
|
#include <Wire.h>
|
||||||
#include <Adafruit_GFX.h>
|
#include <Adafruit_GFX.h>
|
||||||
#include <Adafruit_SSD1306.h>
|
#include <Adafruit_SSD1306.h>
|
||||||
#include <WiFi.h>
|
#include <WiFi.h>
|
||||||
|
#include <SD.h>
|
||||||
|
|
||||||
|
|
||||||
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
#define SCREEN_WIDTH 128 // OLED display width, in pixels
|
||||||
#define SCREEN_HEIGHT 64 // OLED display height, 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 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* ssid = "MagentaWLAN-RGDO";
|
||||||
const char* password = "93329248424922704583";
|
const char* password = "93329248424922704583";
|
||||||
const char* NTP_SERVER = "de.pool.ntp.org";
|
const char* NTP_SERVER = "de.pool.ntp.org";
|
||||||
|
@ -67,6 +79,8 @@ time_t now;
|
||||||
long unsigned lastNTPtime;
|
long unsigned lastNTPtime;
|
||||||
unsigned long lastEntryTime;
|
unsigned long lastEntryTime;
|
||||||
|
|
||||||
|
File myFile;
|
||||||
|
|
||||||
char szZeit[20];
|
char szZeit[20];
|
||||||
|
|
||||||
bool getNTPtime(int sec) {
|
bool getNTPtime(int sec) {
|
||||||
|
@ -124,6 +138,16 @@ void blink(){
|
||||||
digitalWrite (LED_Blue, !HIGH);
|
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){
|
void drawIST(float wert){
|
||||||
char msgt[20];
|
char msgt[20];
|
||||||
dtostrf(wert, 6, 2, msgt);
|
dtostrf(wert, 6, 2, msgt);
|
||||||
|
@ -155,7 +179,16 @@ void drawIST(float wert){
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
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
|
// SSD1306_SWITCHCAPVCC = generate display voltage from 3.3V internally
|
||||||
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
if(!display.begin(SSD1306_SWITCHCAPVCC, 0x3C)) {
|
||||||
Serial.println(F("SSD1306 allocation failed"));
|
Serial.println(F("SSD1306 allocation failed"));
|
||||||
|
@ -165,7 +198,18 @@ void setup() {
|
||||||
display.ssd1306_command(SSD1306_SETCONTRAST);
|
display.ssd1306_command(SSD1306_SETCONTRAST);
|
||||||
display.ssd1306_command(8);
|
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);
|
WiFi.begin(ssid, password);
|
||||||
while (WiFi.status() != WL_CONNECTED) {
|
while (WiFi.status() != WL_CONNECTED) {
|
||||||
delay(500);
|
delay(500);
|
||||||
|
@ -175,16 +219,26 @@ void setup() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
if(!SD.begin(SD_CS)){
|
||||||
|
Serial.println("SD-Card not connected!");
|
||||||
|
while(1){
|
||||||
|
blinkError();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else{
|
||||||
|
Serial.println("SD-Card initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Clear the buffer
|
// Clear the buffer
|
||||||
display.clearDisplay();
|
display.clearDisplay();
|
||||||
display.setTextSize(2); // Normal 1:1 pixel scale
|
display.setTextSize(2); // Normal 1:1 pixel scale
|
||||||
display.setTextColor(WHITE); // Draw white text
|
display.setTextColor(WHITE); // Draw white text
|
||||||
display.setCursor(0,0); // Start at top-left corner
|
display.setCursor(0,0);
|
||||||
display.println("--PT1000--");
|
display.println("--PT1000--");
|
||||||
//display.display();
|
//display.display();
|
||||||
|
//digitalWrite (LED_Blue, HIGH);
|
||||||
pinMode (LED_Blue, OUTPUT);
|
|
||||||
digitalWrite (LED_Blue, HIGH);
|
|
||||||
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
|
Serial.println("Adafruit MAX31865 PT100 Sensor Test!");
|
||||||
|
|
||||||
thermo.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
|
thermo.begin(MAX31865_2WIRE); // set to 2WIRE or 4WIRE as necessary
|
||||||
|
|
Loading…
Reference in New Issue
Block a user