This is my first post, so hello everyone!
I'm really at a loss. I have a microswitch, which is true to
this diagram. I am using the Bounce library, the change example. When I try to get input from the switch, the controller detects it as active when it isn't. I have 5v connected to the common contact, and my digital input connected to the normally open contact.
For anyone unfamiliar with the Bounce code:
void startSweep(){
int sweepRelayValue = LOW;
if (resetBounce.update()) {
if (resetBounce.read() == HIGH) {
if (sweepRelayValue == LOW) {
sweepRelayValue = HIGH;
} else{
sweepRelayValue = LOW;
}
digitalWrite(sweepRelay, sweepRelayValue);
}
}
}
It's only slightly modified from the original bounce example. Instead of 'LED', the variable to switch on is 'sweepRelayValue', and 'button' is 'resetBounce'. I've tried different switches of the same kind, and adjusting the software in all sorts of ways. This must be one of the times I"m overlooking something small, or just doing it wrong. Any help would be appreciated, thanks!