diff --git a/platformio.ini b/platformio.ini index a9ec7ab..e0554c3 100644 --- a/platformio.ini +++ b/platformio.ini @@ -17,4 +17,4 @@ 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 \ No newline at end of file diff --git a/src/main.cpp b/src/main.cpp index 6dc7bd0..819f31d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -48,7 +48,8 @@ int LED_Blue = 2; #include #include #include -#include + + #define SCREEN_WIDTH 128 // OLED display width, in pixels @@ -60,12 +61,12 @@ 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_CS_PIN 15 // or 5 -#define SD_SCK 14 -#define SD_MISO 12 -#define SD_MOSI 13 -#define SD_CS 27 +// These pins will be use for SPI2 +#define SD_CLK_PIN 14 +#define SD_MOSI_PIN 13 +#define SD_MISO_PIN 12 @@ -79,8 +80,6 @@ time_t now; long unsigned lastNTPtime; unsigned long lastEntryTime; -File myFile; - char szZeit[20]; bool getNTPtime(int sec) { @@ -148,6 +147,7 @@ void blinkError(){ digitalWrite (LED_Blue, !HIGH); } + void drawIST(float wert){ char msgt[20]; dtostrf(wert, 6, 2, msgt); @@ -179,7 +179,7 @@ void drawIST(float wert){ void setup() { Serial.begin(115200); - //pinMode (chipSelect, OUTPUT); + //PinMode (chipSelect, OUTPUT); pinMode (LED_Blue, OUTPUT); /* while (!Serial) { @@ -210,6 +210,9 @@ void setup() { display.println("Wait to Wlan."); display.display(); + WiFi.disconnect(); + delay(100); + WiFi.mode(WIFI_STA); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); @@ -217,19 +220,6 @@ 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(); @@ -282,7 +272,7 @@ void loop() { Serial.print("Ratio = "); Serial.println(ratio,8); Serial.print("Resistance = "); Serial.println(RREF*ratio,8); messung = thermo.temperature(RNOMINAL, RREF); - Serial.printf("Temperature: %3.1f °C\n", messung); + Serial.printf("Temperature: %3.3f °C\n", messung); drawIST(messung); // Check and print any faults uint8_t fault = thermo.readFault();