Limit switches on arduino mega 2560 or uno

I have built a 3 axis rotary cnc. I am using grbl 1.1 to control it . I would like to add limit switches. Can someone give me some guidance

There is a whole swath of information for adding limit switches.

Only caveat with GRBL 1.1 is that IIRC a pin for the Z limit was moved / re-purposed.

A couple of links to get you going..
Link 1.

Link 2.

I have looked at these links on github. I have one of my axis wired like the diagram, but it isnt working. If I am understanding the diagram, basically you are grounding one of the limit pins?

In essence yes you will be grounding one of the limit switches but only when contact is made.

In link 1 take note of the capacitors and resistors as some CNC setups can be very noisy electrically and they are of great benefit in those situations.

It may be helpful to know exactly what hardware you have.
Also any error messages your GRBL program is giving you when you make the contact.
With that in mind here are some posting tips.

Posting tips.

  • Always list the version of the IDE you are using and the board version if applicable.
  • How to insert an image into your post. ( Thanks Robin2 )
  • Add your sketch where applicable but please use CODE TAGS ( </> )
  • Add a SCHEMATIC were needed even if it is hand drawn
  • Add working links to any specific hardware as needed (NOT links to similar items)
  • Remember that the people trying to help cannot see your problem so give as much information as you can

I realized what I was doing wrong after some deep thought. I did not have the limit pins enabled in grbl 1.1. I also did not have the homing set up. I wanted the limits to work so I wouldnt over travel when I was jogging. I realize grbl isnt set up for that.

Thank you.
I should have also asked if you had enabled them.
Well congrats on moving forward and posting back for others to learn from our mistakes.