Skip to content

Commit

Permalink
Low-power design
Browse files Browse the repository at this point in the history
  • Loading branch information
lhofinger committed Apr 24, 2023
1 parent 1f13fe1 commit c391e12
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions examples/Touch_and_unlock/Touch_and_unlock.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ void sfmPinInt1() {
void setup() {
SFM.setPinInterrupt(sfmPinInt1); // must perform this step in setup() to attach the inner interrupt.
Serial.begin(115200); // not affiliated with module, just print unlock result.
SFM.disable(); // low-power design, power-off device
}

uint8_t temp = 0; // used to get recognition return
Expand All @@ -25,6 +26,8 @@ void loop() {
if(SFM.isTouched() != lastTouchState) { // Make sure the action just performed once when touch state changes
lastTouchState = SFM.isTouched();
if(SFM.isTouched()) {
SFM.enable(); // low-power design, power-on device
delay(200);
SFM.setRingColor(SFM_RING_RED, SFM_RING_OFF); // Ring fade from red to black at default period (500ms), creating a breathe effect
// Here we are going to start recognition, if unlocked, we will change the ring color to green and send a message
temp = SFM.recognition_1vN(tempUid);
Expand All @@ -35,6 +38,8 @@ void loop() {
}
else {
SFM.setRingColor(SFM_RING_OFF);
delay(200);
SFM.disable(); // low-power design, power-off device
}
}
}

0 comments on commit c391e12

Please sign in to comment.