#define ANGLE 1000 #define SPEED 10 #define WAIT 2 int Radar[100]; int Position; task Turn_radar() { ResetTachoCount( OUT_A); while (true) { Wait( WAIT); RotateMotor( OUT_A, +SPEED, ANGLE); Wait( WAIT); RotateMotor( OUT_A, -SPEED, ANGLE); } } task Radar_unit() { int Distance; SetSensorLowspeed(IN_4); while (true) { Distance = SensorUS( IN_4); Position = MotorTachoCount(OUT_A)*100/ANGLE; LineOut(0,0,Position,0); LineOut(Position,0,99,0,DRAW_OPT_CLEAR); printf("%5d", Distance); Wait( 50); } } task main() { Precedes(Turn_radar,Radar_unit); ClearScreen(); }