Project

General

Profile

Statistics
| Revision:

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

History | View | Annotate | Download (1.03 KB)

1
#include "Forklift.h"
2

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

    
8
#define SPD 200
9
#define TURN_TIME 950
10

    
11

    
12
using namespace Forklift;
13

    
14

    
15
int main()
16
{
17
        dragonfly_init(ALL_ON);
18
        orb_init();
19
        forklift_init();
20
  orb1_set_color(BLUE);
21
  orb2_set_color(YELLOW);
22
        set_height_setpoint(128);
23
  orb1_set_color(PURPLE);
24
  orb2_set_color(RED);
25
        while(true)
26
        {
27
                while(!button2_read());
28
                motor_l_set(BACKWARD, SPD);
29
                motor_r_set(BACKWARD, SPD);
30
                delay_ms(1500);
31
                motor_l_set(BACKWARD, 0);
32
                motor_r_set(BACKWARD, 0);
33
                set_height_setpoint(30);
34
                delay_ms(1000);
35
                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
                motor_r_set(FORWARD, SPD);
42
                delay_ms(TURN_TIME);
43
                motor_l_set(BACKWARD, SPD);
44
                motor_r_set(BACKWARD, SPD);
45
                delay_ms(1500);
46
                motor_l_set(BACKWARD, SPD);
47
                motor_r_set(FORWARD, SPD);
48
                delay_ms(TURN_TIME);
49
                motor_l_set(BACKWARD, 0);
50
                motor_r_set(BACKWARD, 0);
51
                set_height_setpoint(130);
52
        }
53
}