Hi all,
Just started with Arduino and electronics, got a starter kit and worked through the basic projects so this is a noob question. I'm working with a piezo transducer and wanted to add a simple switch to the project so that I don't have to unplug the USB each time I want to stop it sounding. I've followed the simple switch demo but I'm using a 6 pin toggle switch instead of a tactile switch.
I have no idea of the spec of the switch but I've tested it with my Ohmmeter and worked out I need to use 3 of the pins on one side: Power to the center pole, "off" state (left pin) to 10k resistor and then back to ground and "on" state (right pin) to pin 2.
I've tested this without the Arduino and a 6v buzzer to make sure that I've got the pins set up correctly and it works fine.
When I wire up the Arduino and upload the demo code though I find that when I put the switch in the "on" position the LED on the board lights up but when I switch to the "off" position there is a long delay before the light goes off, almost as if there's a capacitor discharging somewhere. I've tried adding a delay to the loop (from 10ms to 100ms) in case it was some kind of latency issue. When I output to the serial monitor and switch from on to off I can see that after a few moments the "on" fluctuates between 1 and 0 before it goes low.
Is it possible I've got some kind of capacitive switch?
I've taken a snapshot of the setup so you can see what I've got. (The L, C and R dots indicate what I'm referring to as center, left and right pins in the description above).
Thanking you in advance for any help you can offer.
Best,
B