Hello,
a bit of a simple question, but I can't seem to find a solution-- I have a limit switch (NO) connected to pin 14 of my teensy LC:
. When the switch closes, it connects the pin to ground. The pull up resistor is activated:
. When I do
with the switch closed, I get a solid 1 (as supposed), but when it is open, the output is random 0 or 1.
I checked the switch, it works fine. Am I missing something obvious here? Could it be that the cable length of 1m from teensy to the switch causes the problem?
thanks, Philip
a bit of a simple question, but I can't seem to find a solution-- I have a limit switch (NO) connected to pin 14 of my teensy LC:
Code:
#define S_limitSwitch 14 // A0
Code:
pinMode(S_limitSwitch, INPUT_PULLUP);
Code:
Serial.print("S_limitSwitch: ");
Serial.println(digitalRead(S_limitSwitch));
I checked the switch, it works fine. Am I missing something obvious here? Could it be that the cable length of 1m from teensy to the switch causes the problem?
thanks, Philip