I’m trying to use three ultrasonic range finders (front, left, right) and two optical shaft encoders (left and right). The two encoders worked fine when I used the robotC sample program. I then tried to add my three ultrasonic range finders to the sample program, and then the left encoder would only report a 0 or 1. After playing around a bit, I found it is only caused by the “front” range finder. If I remove the code #pragma config(Sensor, dgtl9, sonarF, sensorSONAR_mm)], but keep the sensor plugged in, the left encoder works. I’ve tried moving the front senor to different digital ports, but it still causes the problem.
Why is the front ultrasonic range finder code knocking out my left encoder?
Here is the motor and senor setup:
#pragma config(Sensor, dgtl1, rightEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl3, leftEncoder, sensorQuadEncoder)
#pragma config(Sensor, dgtl5, sonarRight, sensorSONAR_mm)
#pragma config(Sensor, dgtl7, sonarLeft, sensorSONAR_mm)
#pragma config(Sensor, dgtl9, sonarF, sensorSONAR_mm)
#pragma config(Motor, port1, leftMotor, tmotorServoContinuousRotation, openLoop, reversed)
#pragma config(Motor, port10, rightMotor, tmotorServoContinuousRotation, openLoop)
Thanks for the help. I appreciate it.