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
|
#include "hardware.h"
#include "Motor.h"
#include "Navigation.h"
Motor *motorLeft = new Motor(&PORTD, &OCR1BL, 0x01, 0x02);
Motor *motorBack = new Motor(&PORTD, &OCR1AL, 0x04, 0x08);
Motor *motorRight = new Motor(&PORTB, &OCR0, 0x01, 0x02);
Navigation *navigation = new Navigation(motorLeft, 60.0, motorBack, 180.0, motorRight, 300.0);
static void delay() {
for(unsigned long i = 0; i < 25000; i++);
}
int main() {
initHardware();
navigation->setSpeed(1.0);
for(int i = 0; ; i = (i+1)%360) {
navigation->setDirection(i);
delay();
}
return 0;
}
|