I think i don't understand about limit switch.
On limit switch ,
- ON pin connect to digital 2
- COM pin connect to GRN
and i try this code to test limit switch but i don't understand why it always show "1" on Serial Monitor although i press into limit switch. So this limit switch cannot change state? , anyone could show me why ?
const int lmswitch1 = 2;
void setup()
{
pinMode(lmswitch1 , INPUT);
}
void loop()
{
if(digitalRead(lmswitch1==LOW)){
Serial.println("1");
delay(1000);
}else{
Serial.println("0");
delay(1000);
}
}