Is it viable to have a wake and sleep interrupt assigned to one toggle switch connected to one pin?

Viewed 19

Programming with an arduino mega 2560. I have a toggle switch connected to pin 19 and ground on the board.

I'm trying to make an interrupt where if I toggle the switch downwards it goes to sleep, and when I toggle it upwards it wakes up. Currently following this tutorial on youtube

on his tutorial I noticed he has two buttons for sleep and wake. With two different pin assignments. Can I do the same effect with a toggle switch? My toggle switch is only connected to one pin. Correct me if I'm wrong but I heard arduino boards need to trigger sleep with FALLING or LOW. Is it possible to have my sleep interrupt on FALLING or LOW and have my wake on RISING/HIGH?

New to programming on Arduinos so bear with me.

0 Answers
Related