Quote:
|
Originally Posted by artdutra04
I'm confused  . According to the Vex Shaft Encoder Manual, the Vex encoders do not plug into the Interrupts. They plug into any port on the Analog/Digital inputs. The Vex Ultrasonic Sensor plugs into the Interrupt ports, and from experience I've had working with the Ultrasonic Sensor, it only pings out when you tell it to in the code.
|
When programming with EasyC the encoders plug into the interrupt port. The way you use it is to create a program block that starts the sensor (begins counting interrupts in the background) and later in the program another block that stops counting. Anywhere in between those you can read the current count or reset it to another value.
So to compute how far your robot has traveled you just read the count number which is in units of 1/90 of a rotation, take into account your wheel diameter, and you have distance.
To compute the speed the robot is moving use a timer block to get the time that has passed since the last shaft encoder reading. Now you have the distance and the time so you can compute the average speed the robot was going.
Brad