Project

General

Profile

Statistics
| Revision:

root / trunk / code / projects / forklift_demo / main.cpp @ 2010

History | View | Annotate | Download (1.03 KB)

1 2007 jabinder
#include "Forklift.h"
2
3
extern "C"
4
{
5
#include <dragonfly_lib.h>
6
}
7
8
#define SPD 200
9 2010 tmullins
#define TURN_TIME 950
10 2007 jabinder
11
12
using namespace Forklift;
13
14
15
int main()
16
{
17
        dragonfly_init(ALL_ON);
18
        orb_init();
19
        forklift_init();
20 2010 tmullins
  orb1_set_color(BLUE);
21
  orb2_set_color(YELLOW);
22 2007 jabinder
        set_height_setpoint(128);
23 2010 tmullins
  orb1_set_color(PURPLE);
24
  orb2_set_color(RED);
25 2007 jabinder
        while(true)
26
        {
27
                while(!button2_read());
28 2010 tmullins
                motor_l_set(BACKWARD, SPD);
29
                motor_r_set(BACKWARD, SPD);
30 2007 jabinder
                delay_ms(1500);
31 2010 tmullins
                motor_l_set(BACKWARD, 0);
32
                motor_r_set(BACKWARD, 0);
33
                set_height_setpoint(30);
34 2007 jabinder
                delay_ms(1000);
35 2010 tmullins
                motor_l_set(BACKWARD, SPD);
36
                motor_r_set(BACKWARD, SPD);
37
                delay_ms(200);
38
                set_height_setpoint(230);
39
                delay_ms(1000);
40
                motor_l_set(BACKWARD, SPD);
41 2007 jabinder
                motor_r_set(FORWARD, SPD);
42 2010 tmullins
                delay_ms(TURN_TIME);
43
                motor_l_set(BACKWARD, SPD);
44 2007 jabinder
                motor_r_set(BACKWARD, SPD);
45 2010 tmullins
                delay_ms(1500);
46
                motor_l_set(BACKWARD, SPD);
47 2007 jabinder
                motor_r_set(FORWARD, SPD);
48 2010 tmullins
                delay_ms(TURN_TIME);
49
                motor_l_set(BACKWARD, 0);
50
                motor_r_set(BACKWARD, 0);
51
                set_height_setpoint(130);
52 2007 jabinder
        }
53 2010 tmullins
}