pilhuhn / xy-plotter

Arduino-code for my XY-plotter
Apache License 2.0
14 stars 4 forks source link

Limit Switch Interrupts not working #3

Open Jim-bee opened 2 years ago

Jim-bee commented 2 years ago

Hi,

I am able to get the motors doing the right things with your commands. When I hit "H" to home X & Y axis's the optical switches are not seen or recognized and no interrupt is ever being created.

I created a separate small routine to test these same limit switch pins and optical switches using attachedInterrupt they all work fine they see the optical switches and create an interrupt.

I am not sure what I am missing in your code but for some reason it will not generate an interrupt to stop the motor when a limit switch is seen. Any guidance would be greatly appreciated.

pilhuhn commented 2 years ago

Hey Jim, When you look at https://github.com/pilhuhn/xy-plotter/blob/master/helpers.ino#L72 you see the pins where the end-switches are wired to. Operating a switch would pull the pin to ground (they are set to input and high by default here: https://github.com/pilhuhn/xy-plotter/blob/master/xy-plotter.ino#L109 ) If you are in non-continuous mode, you can hit 'i' and then hit the switch and it should output which switch it was.