Sumo Robot Code
Autor: Ahmed Wadee • March 10, 2016 • Study Guide • 264 Words (2 Pages) • 873 Views
Page 1 of 2
//sbit
sbit motor_1 at PORTC.b0;
sbit motor_2 at PORTC.b1;
sbit motor_3 at PORTC.b2;
sbit motor_4 at PORTC.b3;
sbit sen_1 at PINB.b0;
sbit sen_2 at PINB.b1;
//variables
float distance;
//functions
void move()
{
motor_1=1;
motor_2=0;
motor_3=1;
motor_4=0;
}
void rot_1()
{
motor_1=1;
motor_2=0;
motor_3=1;
motor_4=1;
}
void rot_2()
{
motor_1=1;
motor_2=1;
motor_3=1;
motor_4=0;
}
void scan()
{
UART1_Write('U');
delay_ms(50);
if(UART1_Data_Ready()==1)
{
distance= UART1_Read();
...