|
Re: Light sensor as shaft encoder too fast for Lab View Code?
There's a reason why you have an LabVIEW Encoder block. If I remember correctly, most of the robot code only gets executed every 40ms. If your sensor goes through a transition state during those 40ms, then it won't be counted.
Now I haven't looked under the cover for the encoder VI, but I would have to imagine it is using some sort of an interrupt, or is polling that digital input very quickly.
You may want to take a look at the encoder block under sensors in the WPI library. If you want to make your own, place a very quick (5ms or less) while or timed loop in your Period Tasks VI.
Do what Alan said below. I believe that will work better than what I recommended.
__________________
Garnet Squadron
FRC 4901
Controls Mentor
@rnazaretian
Previous mentor and student from Team Fusion, FRC 364
Last edited by RyanN : 14-02-2011 at 13:03.
|