|
ubik75
Rookie
Joined: Thu Feb 09, 2012 1:11 pm Posts: 4
|
 Problem with sensor sonar
Hello,
I am french, I have some problem with sensor sonar. When a start program, the value of sensor program is good but after a moment, the sensor sensor falls into default. I see it in the window "NXT Device Control" the sensor value indicates "rangeErr" and after "modeRaw", the value switches from one mode to another. The program runs en RobotC 3.08 (F/W9.12).
#pragma config(Sensor, S1, touchSensor, sensorTouch) #pragma config(Sensor, S2, soundSensor, sensorSoundDB) #pragma config(Sensor, S4, sonarSensor, sensorSONAR) #pragma config(Motor, motorB, motorB, tmotorNormal, PIDControl, encoder) #pragma config(Motor, motorC, motorC, tmotorNormal, PIDControl, encoder) //*!!Code automatically generated by 'ROBOTC' configuration wizard !!*//
#define vit 50
task main() { // synchro moteur a faire une fois nMotorEncoder[motorC] = 0; nMotorEncoder[motorA] = 0;
nSyncedMotors = synchBC; // synchro sur le moteur B qui est maitre nSyncedTurnRatio = 100; while(true) { motor[motorB] = vit; if(SensorRaw(sonarSensor) < 20) { motor[motorB] = 0; wait1Msec(500); motor[motorB] = -vit; wait1Msec(3000); gauche(); } } }
Thank for your help.
Last edited by ubik75 on Fri Apr 06, 2012 2:09 am, edited 1 time in total.
|