Hi,
I'm trying to write a library for a 3-state switch, which includes debouncing as you change state. However, I can't seem to figure out why the code won't work. I tried to incorporate the Debounce library code into my "Three-way" library code but wasn't able to get it to work. Not sure what is wrong. The switch that I'm using is a three-state switch ON-OFF-ON. Whenever I change states on it, the test LEDs that I'm using don't light up for some reason.
I wired up each state to a digital input line with a PULLUP resistor enabled. To test each state, I use an LED each connected to 220 ohm resistor connected to a digital line.
I have included my "Three-way" library. Also, I have included the script file test5.ino to run the program. Also, I included the Debounce library as well for reference.
If anyone has any input or ideas, it would well be appreciated. Thanks.
dparduino
Debounce.zip (67.1 KB)
test5.ino (1.23 KB)
Three_way.zip (966 Bytes)