|
Down sensors had no issues when detecting edge of table tests. But I'm know experiencing inconsistencies with down sensors when trying to detect white ring on sumo rink. On the same test/run, you can see the led's turn off when the sensors detect the white ring but the robot responds differently all the time, e.g. 1)sometimes there's a delay (goes about 3 inches off rink), and then it'll execute instructions, 2) will not execute constructions or 3) executes instructions as expected. I have tried MANY settings on the sensitivity control and with/without initialization of respective digital ports with no success.
OtHer info: currently happening on only two robots. The other three robots as working as expected as of this past Wednesday.
Please help. Thanks.
Sensors QRB114 ---------------------------------------------------------------------- #include <machinescience.h> #include <mastermod.h>
int main(void) { servo_control(ENABLE); //Initialize servo motor control digital_port(5, INPUT); //Initialize digital port input #5 //digital_port(0, INPUT); //Initialize digital port input #0 //digital_port(1, INPUT); //Initialize digital port input #1
while(1==1) //Execute the following code repeatedly { delay_ms(2000); if (digital_read(0)==HIGH) //If left down sensor detects white rim on SUMO rink { //Move the robot in reverse for 1.5 seconds and spin servo_robot(REVERSE, 50); delay_ms(1500); servo_robot(SPIN_RIGHT, 30); delay_ms(250); } else if (digital_read(1)==HIGH) //If right down sensor detects white rim on SUMO rink { //Move the robot in reverse for 1.5 second and turn servo_robot(REVERSE, 50); delay_ms(1500); servo_robot(SPIN_LEFT, 40); delay_ms(350); } // else if (digital_read(5)==HIGH) //If front sensor detects an object //{ //servo_robot(FORWARD, 100); //Make robot move at full speed //} else { servo_robot(FORWARD, 40); //Move forward at normal speed }
} end(); //End program }
|