// 74+.c - Criado pelo studio UNO 2.3
// 17 November 2015 1:22:47 pm
#include <uno.h>
// Prototipos
void bumpers(void);
void curvas(void);
//Funcoes do Usuario
void bumpers(void)
{
if (!__digital_in(5)) {
__motor_curso(__BACKWARD);
__delay(1000);
__motor_curso(__RIGHT_ROTATE);
__delay(650);
__motor_curso(__STOP);
}
if (!__digital_in(6)) {
__motor_curso(__BACKWARD);
__delay(1000);
__motor_curso(__LEFT_ROTATE);
__delay(650);
__motor_curso(__STOP);
}
}
void curvas(void)
{
if (!testbit(__IR, 6)) {
if ((!testbit(__IR, 1) || __LEFT_KEY)) {
__motor_curso(__LEFT_ROTATE);
}
if ((!testbit(__IR, 3) || __RIGHT_KEY)) {
__motor_curso(__RIGHT_ROTATE);
}
}
else {
if ((!testbit(__IR, 1) || __LEFT_KEY)) {
__motor_curso(__LEFT_TURN);
}
if ((!testbit(__IR, 3) || __RIGHT_KEY)) {
__motor_curso(__RIGHT_TURN);
}
}
}
//Funcao Principal
void main(void)
{
__inicializa;
__IR__ON();
while(TRUE) {
if ((!testbit(__IR, 0) || __UP_KEY)) {
__motor_curso(__FORWARD);
}
if ((!testbit(__IR, 4) || __BOTTOM_KEY)) {
__motor_curso(__BACKWARD);
}
if ((!testbit(__IR, 2) || __ENTER_KEY)) {
__motor_curso(__STOP);
}
if (!testbit(__IR, 5)) {
__beep();
}
curvas();
bumpers();
}
while(TRUE) { }
}