deep sleep when no card
This commit is contained in:
parent
b1bdc9b840
commit
5f6a52f6a2
1 changed files with 5 additions and 1 deletions
|
|
@ -70,6 +70,7 @@ void send_uid(char reader_uid[]);
|
||||||
|
|
||||||
void setup() {
|
void setup() {
|
||||||
Serial.begin(115200);
|
Serial.begin(115200);
|
||||||
|
delay(1000);
|
||||||
|
|
||||||
pinMode(LED_PIN, OUTPUT);
|
pinMode(LED_PIN, OUTPUT);
|
||||||
|
|
||||||
|
|
@ -82,6 +83,10 @@ void loop() {
|
||||||
read_card(reader_uid);
|
read_card(reader_uid);
|
||||||
send_uid(reader_uid);
|
send_uid(reader_uid);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
delay(200);
|
||||||
|
ESP.deepSleep(SLEEP_DURATION * 1000000);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_card(char reader_uid[]) {
|
void read_card(char reader_uid[]) {
|
||||||
|
|
@ -132,7 +137,6 @@ void send_uid(char reader_uid[]) {
|
||||||
|
|
||||||
https.end();
|
https.end();
|
||||||
Serial.print("[HTTPS] ended...\n");
|
Serial.print("[HTTPS] ended...\n");
|
||||||
ESP.deepSleep(SLEEP_DURATION * 1000000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void byte_to_string(byte array[], unsigned int len, char buffer[]) {
|
void byte_to_string(byte array[], unsigned int len, char buffer[]) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue