What kind of motor? The basic idea is, a code is running that moves the motor, whether PWM commands to a DC motor, or step instructions to a stepper. If the limit switch puts a 1 or 0 to a pin, the code stops.
Ok, if the code says run the motor at some speed, after setting the the code can look for a pin state change, maybe the pin is held high by a 10k pull, the limit switch shorts it to ground, presenting a 0 at the pin. There are STamp versions that have an interrupt that could look for the switch behind the scenes, so the code can be doing other things.
I would suggest you start from the beginning by looking for a document here called "What's a Microcontroller?"
Detecting a limit switch is the simplkest thing that can be done, but I suspect you need some background first. Study the download I just mentioned and your question will be answered.
This is the powerpoint version, I am looking for the text
Comments
Post Edited (TChapman) : 3/24/2007 5:08:49 AM GMT
I would suggest you start from the beginning by looking for a document here called "What's a Microcontroller?"
Detecting a limit switch is the simplkest thing that can be done, but I suspect you need some background first. Study the download I just mentioned and your question will be answered.
This is the powerpoint version, I am looking for the text
www.parallax.com/html_pages/edu/downloads/wam_pres.asp
Here is the text DL version:
www.parallax.com/dl/docs/books/edu/wamv2_2.pdf
Post Edited (TChapman) : 3/24/2007 5:25:24 AM GMT