/*
* File: motors_exploration_main.c
* Author: Sam Lin & Jerry Xu
*
* Created on July 17, 2018, 10:09 AM
*/
#include <stdio.h>
#include <stdlib.h>
#include "serial.h"
#include "BOARD.h"
#include "roach.h"
#include "timers.h"
/*
*
*/
int main(int argc, char** argv) {
SERIAL_Init();
BOARD_Init();
Roach_Init();
TIMERS_Init();
while (1) {
Roach_LeftMtrSpeed(48); //minimum speed of 48 to turn the wheels
/*while (1) {
int speed = 100;
while (speed != -100) {
TIMERS_SetTimer(0, 25);
TIMERS_StartTimer(0);
while (TIMERS_IsTimerActive(0)) {
};
Roach_LeftMtrSpeed(speed);
Roach_RightMtrSpeed(speed);
printf("%d\r\n", speed);
speed--;
}
while (speed != 100) {
TIMERS_SetTimer(0, 25);
TIMERS_StartTimer(0);
while (TIMERS_IsTimerActive(0)) {
};
Roach_LeftMtrSpeed(speed);
Roach_RightMtrSpeed(speed);
printf("%d\r\n", speed);
speed++;
}
*/
/* if (TIMERS_GetTime % 2000 > 1000){
time = (TIMERS_GetTime % 2000) / 20
Roach_LeftMtrSpeed(time);
Roach_RightMtrSpeed(time);
}
if (TIMERS_GetTime % 2000 <= 1000){
time = (TIMERS_GetTime % 2000) / 20
Roach_LeftMtrSpeed(time);
Roach_RightMtrSpeed(time);
}
Roach_LeftMtrSpeed(100);
Roach_RightMtrSpeed(100);
}
TIMERS_InitTimer(0, 2000);
while (TIMERS_IsTimerActive(0)) {
Roach_LeftMtrSpeed(-100);
Roach_RightMtrSpeed(-100);
}
*/
}
return (EXIT_SUCCESS);
}