Hallo,
leider kenne ich mich nicht wirklich mit Programmierung aus, muss aber für die Schule einen Wecker bauen, der sich später über eine App steuern lässt.
Mein Problem:
Der ESP32 hängt in einer Bootloop fest und ich kann wegen mangelnder Kenntnisse nicht wirklich sagen woran es liegen könnte. Eine Googlesuche hat einen möglichen Integer-Overflow ergeben, aber wirklich weitergeholfen hat mir das nicht.
Edit: Ich habe jetzt herausgefunden, dass das RTC-Modul wohl die Ursache war, aber dann bleibt die Frage warum. Ich habe ein DS3231 am ESP32 angeschlossen, da ich eine Pufferung vorgesehen hatte.
Edit: Ich finde es zwar schön, dass ihr meinen Beitrag formatiert, aber eine wirkliche Hilfe ist das nicht.
Fehlermeldung aus dem Monitor
Rebooting...
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:10944
load:0x40080400,len:6388
entry 0x400806b4
Guru Meditation Error: Core 1 panic'ed (LoadProhibited). Exception was unhandled.
Core 1 register dump:
PC : 0x400d3a02 PS : 0x00060530 A0 : 0x800d1ac8 A1 : 0x3ffc77b0
A2 : 0x3ffc3cac A3 : 0x00000000 A4 : 0x00000200 A5 : 0x00000001
A6 : 0x0000007f A7 : 0x00000006 A8 : 0x800d39d7 A9 : 0x3ffc7790
A10 : 0x3ffc4164 A11 : 0x00000040 A12 : 0x40177a7c A13 : 0x00000006
A14 : 0x0000007f A15 : 0x40177a7c SAR : 0x00000010 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0x00000000
ELF file SHA256: 0000000000000000
Backtrace: 0x400d3a02:0x3ffc77b0 0x400d1ac5:0x3ffc77d0 0x400d5908:0x3ffc7820 0x4009080a:0x3ffc7840
Code:
#include <RTClib.h>
#include "BluetoothSerial.h"
#include <EEPROM.h>
#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 32
//Variablen
int Hor, Min, Sec, tim, dat, h, m, s;
int StundeWeckzeit = 6;
int MinuteWeckzeit = 0;
int DauerWecksignal = 3;
int buzzer = 19;
String Stunde, Minute, Weckzeit;
//Konfig OLED//
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, -1);
BluetoothSerial SerialBT;
RTC_DS3231 rtc;
void setup() {
//RTC//
rtc.begin();
if(rtc.lostPower()) {
// this will adjust to the date and time at compilation
rtc.adjust(DateTime(F(__DATE__), F(__TIME__)));
//Serial//
Serial.begin(9600);
SerialBT.begin("Wecker");
Serial.println("Gerät gestartet");
//Display//
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
display.clearDisplay();
display.display();
display.setTextColor(WHITE);
display.setTextSize(1);
}
}
void loop() {
//BT//
if(Serial.available())
{
SerialBT.write(Serial.read());
}
if(SerialBT.available())
{
Serial.write(SerialBT.read());
}
delay(20);
DateTime aktuell = rtc.now();
display.setCursor(0, 0);
display.print(aktuell.day());
display.print(".");
display.print(aktuell.month());
display.print(".");
display.print(aktuell.year());
display.setCursor(0, 2);
if (aktuell.hour() < 10) display.print("0");
display.print(aktuell.hour());
display.print(":");
if (aktuell.minute() < 10) display.print("0");
display.print(aktuell.minute());
display.print(":");
if (aktuell.second() < 10) display.print ("0");
display.print(aktuell.second());
if (StundeWeckzeit < 10 && MinuteWeckzeit < 10) Weckzeit = "0"
+ String(StundeWeckzeit) + ":0" + String(MinuteWeckzeit);
if (StundeWeckzeit < 10 && MinuteWeckzeit > 9) Weckzeit = "0" + String(StundeWeckzeit)
+ ":" + String(MinuteWeckzeit);
if (StundeWeckzeit > 9 && MinuteWeckzeit < 10) Weckzeit = String(StundeWeckzeit)
+ ":0" + String(MinuteWeckzeit);
if (StundeWeckzeit > 9 && MinuteWeckzeit > 9) Weckzeit = String(StundeWeckzeit) + ":"
+ String(MinuteWeckzeit);
display.setCursor(0, 3);
display.print("Weckzeit: " + Weckzeit);
if (aktuell.hour() < 10) Stunde = "0" + String(aktuell.hour());
else Stunde = String(aktuell.hour());
if (aktuell.minute() < 10) Minute = "0" + String(aktuell.minute());
else Minute = String(aktuell.minute());
String aktuelleZeit = Stunde + ":" + Minute;
if (aktuelleZeit == Weckzeit && aktuell.second() < DauerWecksignal)
{
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(50);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(50);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(50);
digitalWrite(buzzer, HIGH);
delay(100);
digitalWrite(buzzer, LOW);
delay(50);
}
display.display();
}
J-M-L EDIT - code tags.