1) Check US Sensor
2) Move Motor
3) Check US Sensor
4) Move Motor
5) Check US Sensor
6) Move Motor Back To Starting Position
7) Display Values
The motor move fine, but on the NXT's screen, it says "0", "0", and "0";
The US Sensor is connected correctly into port 4.
Code: Select all
task main(){
int distance1;
int distance2;
int distance3;
bool object_forward;
bool object_left;
bool object_right;
distance1=SensorUS(S4); // Forward
RotateMotor(OUT_A, 75, 90);
distance2=SensorUS(S4); // Right
RotateMotor(OUT_A, -75, 180);
distance3=SensorUS(S4); // Left
RotateMotor(OUT_A, 75, 90);
TextOut(0, 0, NumToStr(distance1));
TextOut(0, 8, NumToStr(distance2));
TextOut(0, 16, NumToStr(distance3));
//More Stuff....
}
Please Reply With What I Am Doing Wrong.
-- Clen, Pesso, Tanf, Whatever You Want To Call Me