power rfid only when not sleeping
This commit is contained in:
parent
5f6a52f6a2
commit
c6c70dca76
1 changed files with 4 additions and 0 deletions
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#define LED_PIN LED_BUILTIN
|
||||
#define SS_PIN SDA
|
||||
#define RC522_POWER_PIN 1
|
||||
#define SLEEP_DURATION 1
|
||||
|
||||
#define RGB_BRIGHTNESS 4 // Change neopixel brightness (max 255)
|
||||
|
|
@ -74,6 +75,8 @@ void setup() {
|
|||
|
||||
pinMode(LED_PIN, OUTPUT);
|
||||
|
||||
pinMode(RC522_POWER_PIN, OUTPUT);
|
||||
digitalWrite(RC522_POWER_PIN, HIGH);
|
||||
reader.PCD_Init(); // Init each MFRC522 card.
|
||||
}
|
||||
|
||||
|
|
@ -85,6 +88,7 @@ void loop() {
|
|||
}
|
||||
else {
|
||||
delay(200);
|
||||
digitalWrite(RC522_POWER_PIN, LOW);
|
||||
ESP.deepSleep(SLEEP_DURATION * 1000000);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue