|
Re: Gear Tooth Counter for height
It is possible, legal, and should work fine. Just have the code reset the 'known' position at the start of each match.
A PID loop is used to control a setpoint. One example is a car cruise control (maintains constant speed), another is a kitchen oven (maintains constant temperature).
What you may want to use is called an "Interrupt". This is a special hardware connection (to the Digital sidecar) that signals the cRio's processor "STOP Whatever you are doing and run this piece of code. Immediately. Now". In your case, that code might add +1 (or subtract -1 if the lift motor is running backwards) to a counter that keeps track of lift position. Clearly, the code must be as brief as possible, since your processor is literally unable to do ANYthing else while the interrupt is active. (The interrupt gets activated by the sensor signal)
Do your own research on the highlighted words to understand and do it.
__________________
I am N2IRZ - What's your callsign?
|