kopia lustrzana https://github.com/sh123/esp32_loraprs
Use GPIO2 builtin esp32 led as a watchdog
rodzic
a2e6eb5a39
commit
3f1b4a6bd8
|
@ -1,6 +1,10 @@
|
|||
#include <timer.h>
|
||||
#include "WiFi.h"
|
||||
#include "loraprs.h"
|
||||
|
||||
#define LED_BUILTIN 2
|
||||
#define LED_TOGGLE_PERIOD 1000
|
||||
|
||||
#define LORAPRS_CLIENT
|
||||
|
||||
#define LORAPRS_FREQ 432.5E6
|
||||
|
@ -27,13 +31,26 @@ LoraPrs loraPrs(
|
|||
LORAPRS_LOGIN,
|
||||
LORAPRS_PASS);
|
||||
|
||||
auto watchdogLedTimer = timer_create_default();
|
||||
|
||||
void setup() {
|
||||
pinMode(LED_BUILTIN, OUTPUT);
|
||||
digitalWrite(LED_BUILTIN, 1);
|
||||
|
||||
Serial.begin(115200);
|
||||
while (!Serial);
|
||||
|
||||
loraPrs.setup();
|
||||
|
||||
watchdogLedTimer.every(LED_TOGGLE_PERIOD, toggleWatchdogLed);
|
||||
}
|
||||
|
||||
void loop() {
|
||||
loraPrs.loop();
|
||||
watchdogLedTimer.tick();
|
||||
}
|
||||
|
||||
bool toggleWatchdogLed(void *) {
|
||||
digitalWrite(LED_BUILTIN, !digitalRead(LED_BUILTIN));
|
||||
return true;
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue