0

Debounce algorithm help needed and clearing thedata from scr
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Debounce algorithm help needed and clearing thedata from scr

by dkanday on Mon Jun 21, 2021 5:45 pm

Hi,

I am using an Audrino Uno with a fingerprint sensor, adafruit 1.44TFT display and a momentary switch. The logic I am using is when the switch is pressed and logic goes low, enroll fingerprint and when the switch is NC (that is logic is high), keep searching for finger print.
The issue I am facing is that the fingerprint sensor is always looking for fingerprint, so when it is waiting for fingerprint I press the switch it goes into enrollment correctly(which is good) but when I do the other round that is during the enrollment process I release the switch, it goes into a loop of communication error.

I have implemented this logic in clue and it works fine, because of the debounce algorithm(I think). Is there a debounce algorithm code available which I can use in my code?

Also is there an easy way that I can clear my screen and start at 0,0 cursor point after the finger print match is found. Sometimes the data keeps overlapping.

I have attached the code for reference.
Attachments
v16_06212021.ino
(22.88 KiB) Downloaded 1 time

dkanday
 
Posts: 41
Joined: Mon Jun 07, 2021 4:49 pm

Re: Debounce algorithm help needed and clearing thedata from

by dastels on Mon Jun 21, 2021 8:32 pm


dastels
 
Posts: 6787
Joined: Tue Oct 20, 2015 3:22 pm

Re: Debounce algorithm help needed and clearing thedata from

by dastels on Mon Jun 21, 2021 8:36 pm

As for clearing the screen, fill it with black using void fillScreen(uint16_t color); from the GFX library.

Dave

dastels
 
Posts: 6787
Joined: Tue Oct 20, 2015 3:22 pm

Re: Debounce algorithm help needed and clearing thedata from

by dkanday on Tue Jun 22, 2021 10:22 am

Thanks a ton! Will give those ideas a shot

dkanday
 
Posts: 41
Joined: Mon Jun 07, 2021 4:49 pm

Re: Debounce algorithm help needed and clearing thedata from

by dkanday on Tue Jun 22, 2021 2:27 pm

Both the solutions worked for me. Thanks again! :)

dkanday
 
Posts: 41
Joined: Mon Jun 07, 2021 4:49 pm

Re: Debounce algorithm help needed and clearing thedata from

by dastels on Tue Jun 22, 2021 3:38 pm

Excellent!

Dave

dastels
 
Posts: 6787
Joined: Tue Oct 20, 2015 3:22 pm

Please be positive and constructive with your questions and comments.