Read buttons outside main loop function?

Hi all!

I am new to this adruino platform, I read a lot of documentation here but can not find any solution to this printing issue.

I am using an ARDUINO UNO for a SPL sensor, an 16x2 LCD with some buttons to set up the software. Once I added some bouncing control to the switches using the delay option I start to see my lcd blink because of that delay since lcd.write function is within the main loop as the buttons comparison.

Is it possible to attack the button check within timer tick or something like that? Or use any built in interrupt? I have 5 buttons and use analog read to identify pressed one.

Thanks for your time!!!

Yes you can get rid of the delays. Study the Blink Without Delay example that came with your IDE.


You can also look at some of the switch libraries out there. Here is one I like (see reply #1):

BTW, Attach your code using the </> icon on the left side of the posting menu.