Hi
Can someone please advise what's happening here.
The below code tells pin 11 to go HIGH if A0 is HIGH.
It does this and puts power to a relay but the Serialprint says pin11 is low "0".
Pin 11 "A0" is wired to a limit switch with an external 10k PULLUP resistor.
If A0 is grounded (ie LOW), it will print LIMIT SWITCH STATUS = .....0.
If A0 is pulled high (ie HIGH), it will print LIMIT SWITCH STATUS = .....1.
If you aren't using a board with native USB, there will however be a significant delay between the level on A0 changing and that change being reflected in the serial monitor. This is caused by printing the level every time loop() executes and using such a slow baud rate. You'll have to wait until all the old statuses are sent and shown before seeing the current value.
Come in to the 21st century. Use 115200 unless you have a very good reason not to. And only print the switch status when it changes.
Hi Thanks for taking the time with this and your explanation.
I have fried my brain going over this today and I am still not fully grasping it.
I need to look again tomorrow