Hello!
First post; first code! I don't have a picaxe to try it out on, but I thought I'd run it past the picaxe brain trust.
Overview:
I have a 2x4 array of NO momentary buttons which, upon closure, supply 5v. Each switch is destined to control two switches in a CD4066 (datasheet). One CD4066 switch will toggle an audio signal, the other will toggle a 5v or 9v supply to illuminate an LED. There are 8 buttons and 4 CD4066 (16 spst, two for each button). The bridge between the push switches and the CD4066 is the 20X2 - 8 inputs and 8 outputs.
Code:
First post; first code! I don't have a picaxe to try it out on, but I thought I'd run it past the picaxe brain trust.
Overview:
I have a 2x4 array of NO momentary buttons which, upon closure, supply 5v. Each switch is destined to control two switches in a CD4066 (datasheet). One CD4066 switch will toggle an audio signal, the other will toggle a 5v or 9v supply to illuminate an LED. There are 8 buttons and 4 CD4066 (16 spst, two for each button). The bridge between the push switches and the CD4066 is the 20X2 - 8 inputs and 8 outputs.
Code:
Any comments about the code? Might it work or is there a better way to use the 20X2? Thanks for any comments and recommendations!SYMBOL LED1 = 0
SYMBOL LED2 = 1
SYMBOL LED3 = 2
SYMBOL LED4 = 3
SYMBOL LED5 = 4
SYMBOL LED6 = 5
SYMBOL LED7 = 6
SYMBOL LED8 = 7
main:
if pinC.7 = 1 then toggle LED1
pause 10
end if
if pinC.6 = 1 then toggle LED2
pause 10
end if
if pinC.5 = 1 then toggle LED3
pause 10
end if
if pinC.4 = 1 then toggle LED4
pause 10
end if
if pinC.3 = 1 then toggle LED5
pause 10
end if
if pinC.2 = 1 then toggle LED6
pause 10
end if
if pinC.1 = 1 then toggle LED7
pause 10
end if
if pinC.0 = 1 then toggle LED8
pause 10
end if