![]() |
sample limit switch code???
anyone got one??? :confused:
we need it to program our arm |
Re: sample limit switch code???
Im pretty sure the default code already has PWMs and relay outputs that are programmed to stop if certain digital input pins are pulled low by an external switch.
From the top of my head, I think relay out 8 is tied to digital input 16? intended to be used with the compressor and the pressure limit switch? - that would be a good example of how to start. |
Re: sample limit switch code???
we are trying to use limit switch as interrupts... and when the arm hits the switch, it will stop moving, that's our plan :)
|
Re: sample limit switch code???
then you would probably need a single-edge based interrupt pin to determine when the circuit goes from open to closed.
|
Re: sample limit switch code???
it would be much simpler to have the line of code that is controlling the motor also look at the limit switch on a digital input pin, instead of using interrupts
this is not really an interrupt application, because you are controlling the motor output on every loop of your code anyway, there is no reason to interrupt the loop when the switch closes - the victors and spikes dont respond that fast. besides, contact switches bounce when they open and close - which means, instead of simply going from 0 to 1, they go 0000111110011011010101111111111 - so for every switch closure you will see maybe 20 to 100 interrupts within several milliseconds. |
Re: sample limit switch code???
Quote:
Code:
/*---------- PWM outputs Limited by Limit Switches ------------------------*/ |
| All times are GMT -5. The time now is 17:26. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi