forked from UWARG/RC-Car-Bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
44 lines (37 loc) · 1.06 KB
/
main.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* File: main.c
* Author: Chris Hajduk
*
* Created on August 21, 2014, 11:32 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include "GPS.h"
#include "main.h"
#include "HunterTruckAPI.h"
#include "debug.h"
#include "timer.h"
#include "OutputCompare.h"
#include "InterchipDMA.h"
#include "PWM.h"
_FOSCSEL(FNOSC_FRC); // Internal FRC oscillator
_FOSC(FCKSM_CSECMD & OSCIOFNC_OFF & POSCMD_NONE);
_FWDT(FWDTEN_OFF & WDTPOST_PS2048 & WDTPRE_PR128); //32,128
/*
*
*/
extern GPSData GPS;
int main(int argc, char** argv) {
initTruck();
while(TRUE){
//This is how you move the car. Throttle goes from -100% to 100%. Steering goes from -100 to 100%.
setThrottle(0); //Note that the first -20%/20% is a safety buffer region. Anything less than 20% is equivalent to no throttle.
setSteering(0);
// This is an example of how you can print the GPS time to the debugging interface.
char str[16];
sprintf((char *)&str, "Time: %lu", getTime());
debug((char *)&str);
background();
}
return (EXIT_SUCCESS);
}