//Mode : Xbee
// Description : Control the robot using UART ( XBEE or an UART wireless module.
//======================================================
void wireless_xbee (void)
{
lcd_clr();
while(1)
{
lcd_goto (0);
if (data[0] == 100)
{
send_string(" XBEE CONTROL ");
SPEEDL = 200;
SPEEDR = 200;
while(1)
{
lcd_goto(20);
if (RCREG == '8')
{
forward();
send_string("FORWARD ");
}
else if (RCREG == '2')
{
backward();
send_string("BACKWARD ");
}
else if (RCREG == '6')
{
right();
send_string("TURN RIGHT ");
}
else if (RCREG == '4')
{
left();
send_string("TURN LEFT ");
}
else if (RCREG == '5')
{
stop();
send_string("INVALID COMMAND ");
}
else
{
stop();
send_string("INVALID COMMAND ");
}
}
}
else send_string("COMMAND");
}
}
Monday, February 22, 2010
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment