Problem with ultrasonic sensor
Posted: 07 Jan 2011, 00:24
I had made that simple code to read US sensor value:
task main()
{
int x;
SetSensorLowspeed(IN_4);
Wait(1000);
TextOut(1,LCD_LINE1,"first");
x=SensorUS(IN_4);
NumOut(40,LCD_LINE1,x);
Wait(1000);
while (true)
{
NumOut(10,LCD_LINE3,SensorUS(IN_4));
}
}
It's working but for example slow mowing from wall form 20cm going to 99cm is ok.. after I going further (over 100cm) and move fast closer then value is three digits. Last digit is constant, first two are changing as normal value of distance.
If sensor is over rich distance and after go back doing similar sort of problem.
When I testing in "NXT Datalog" sensor working good.
Please help!! thanks!!
task main()
{
int x;
SetSensorLowspeed(IN_4);
Wait(1000);
TextOut(1,LCD_LINE1,"first");
x=SensorUS(IN_4);
NumOut(40,LCD_LINE1,x);
Wait(1000);
while (true)
{
NumOut(10,LCD_LINE3,SensorUS(IN_4));
}
}
It's working but for example slow mowing from wall form 20cm going to 99cm is ok.. after I going further (over 100cm) and move fast closer then value is three digits. Last digit is constant, first two are changing as normal value of distance.
If sensor is over rich distance and after go back doing similar sort of problem.
When I testing in "NXT Datalog" sensor working good.
Please help!! thanks!!