Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
49 lines (39 sloc) 1.12 KB
#include "grabber_controller.h"
task main()
{
init_grabber_controller();
while(true)
{
update_sensors();
float u_left = get_ultrasonic_distance(ULTRASONIC_LEFT_SENSOR_ID);
float u_right = get_ultrasonic_distance(ULTRASONIC_RIGHT_SENSOR_ID);
bool detected = false;
TextOut(0, LCD_LINE1, "Sensor Values:");
TextOut(0, LCD_LINE3, " LEFT");
if(u_left < ULTRASONIC_MAX)
{
TextOut(0, LCD_LINE3, "DETECTED");
detected = true;
}
else
TextOut(0, LCD_LINE3, "NULL");
TextOut(0, LCD_LINE4, "DISTANCE");
NumOut(50, LCD_LINE4, u_left);
TextOut(0, LCD_LINE5, " RIGHT");
if(u_right < ULTRASONIC_MAX)
{
TextOut(0, LCD_LINE6, "DETECTED");
detected = true;
}
else
TextOut(0, LCD_LINE6, "NULL");
TextOut(0, LCD_LINE7, "DISTANCE");
NumOut(50, LCD_LINE7, u_right);
if(detected)
{
do_beep_detected_object();
}
Wait(50);
ClearScreen();
}
}
Jump to Line
Something went wrong with that request. Please try again.