Hello,
I am using a CNC shield to control stepper motors using the Arudino IDE. The part I am stuck on is using the limit switch pins to get input from a button. (Essentially I want to run the Ardunio button example, but with a CNC shield on the Arduino)
From the attached image I see that the X limit switch input goes to pin 9.
So, I have been testing whether input works using this code
const int inpin9 = 9;
int state9 = 0;
void setup() {
Serial.begin(9600);
}
void loop() {
state9 = digitalRead(inpin9);
Serial.print(state9);
delay(500);
}
It works as expected when I have the push button set up per the button example. But when I add the CNC shield it does not work as expected.
If- on the CNC shield- I connect the postive side of X+ to the ground side of X+ as labeled by the green line in my image this does not return high.
I tried to measure the voltage and it does not seem like the V+ pin gives off any of its own. So, I tried to directly connect the 5V from the ardunio (blue arrow in my image) to the X+ ground. This may have had too much draw as my Arduino stopped returning serial monitor information when I did this and its LEDs turned off.
I have spent a few hours trying to figure this out, and I am very new to all of this- so dumbed down explanations would be much appreciated!
In summary: how do I get button input from a CNC shield using the limit switch pins?
Thank you for your time!