Revision 2007

View differences:

trunk/code/projects/forklift_demo/main.cpp
1
#include "Forklift.h"
2

  
3
extern "C"
4
{
5
#include <dragonfly_lib.h>
6
}
7

  
8
#define SPD 200
9

  
10

  
11
using namespace Forklift;
12

  
13

  
14
int main()
15
{
16
	dragonfly_init(ALL_ON);
17
	orb_init();
18
	forklift_init();
19
	set_height_setpoint(128);
20
	while(true)
21
	{
22
		while(!button2_read());
23
		motor_l_set(FORWARD, SPD);
24
		motor_r_set(FORWARD, SPD);
25
		delay_ms(1500);
26
		motor_l_set(FORWARD, 0);
27
		motor_r_set(FORWARD, 0);
28
		set_height_setpoint(0);
29
		delay_ms(1000);
30
		motor_l_set(FORWARD, SPD);
31
		motor_r_set(FORWARD, SPD);
32
		delay_ms(200);
33
		set_height_setpoint(255);
34
		motor_l_set(FORWARD, SPD);
35
		motor_r_set(BACKWARD, SPD);
36
		delay_ms(500);
37
		motor_l_set(FORWARD, SPD);
38
		motor_r_set(FORWARD, SPD);
39
		delay_ms(1500);
40
		motor_l_set(FORWARD, SPD);
41
		motor_r_set(BACKWARD, SPD);
42
		delay_ms(500);
43
		motor_l_set(FORWARD, 0);
44
		motor_r_set(FORWARD, 0);
45
		set_height_setpoint(128);
46
	}
47
}

Also available in: Unified diff