-
Notifications
You must be signed in to change notification settings - Fork 0
/
motor.h
50 lines (42 loc) · 1.48 KB
/
motor.h
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
44
45
46
47
48
49
50
/*
* motor.h
*
* Created on: Nov 27, 2010
* Author: fettlaus
*/
#ifndef MOTOR_H_
#define MOTOR_H_
//Movements
#define dir_stop() set_motor(0,0,0,0,0,0);
#define dir_n(sp) set_motor(1,0,0,sp,sp,0);
#define dir_no(sp) set_motor(1,0,0,sp,0,sp);
#define dir_so(sp) set_motor(0,1,0,0,sp,sp);
#define dir_s(sp) set_motor(0,1,0,sp,sp,0);
#define dir_sw(sp) set_motor(0,0,1,sp,0,sp);
#define dir_nw(sp) set_motor(0,0,1,0,sp,sp);
/**
* Only use even parameters for sp! (2,4,6,8,10)
*/
#define dir_o(sp) set_motor(1,1,0,(sp/2),(sp/2),sp);
/**
* Only use even parameters for sp! (2,4,6,8,10)
*/
#define dir_w(sp) set_motor(0,0,1,(sp/2),(sp/2),sp);
#define dir_trn_no(sp) set_motor(1,0,0,sp,(sp/2),0);
#define dir_trn_nw(sp) set_motor(1,0,0,(sp/2),sp,0);
#define trn_c(sp) set_motor(1,1,1,sp,sp,sp);
#define trn_c_n(sp) set_motor(0,0,0,0,0,sp);
#define trn_c_no(sp) set_motor(1,0,1,sp,0,sp);
#define trn_c_so(sp) set_motor(0,0,0,sp,0,0);
#define trn_c_s(sp) set_motor(1,1,0,sp,sp,0);
#define trn_c_sw(sp) set_motor(0,1,0,0,sp,0);
#define trn_c_nw(sp) set_motor(0,1,1,0,sp,sp);
#define trn_cc(sp) set_motor(0,0,0,sp,sp,sp);
#define trn_cc_n(sp) set_motor(0,0,1,0,0,sp);
#define trn_cc_no(sp) set_motor(0,0,0,sp,0,sp);
#define trn_cc_so(sp) set_motor(1,0,0,sp,0,0);
#define trn_cc_s(sp) set_motor(0,0,0,sp,sp,0);
#define trn_cc_sw(sp) set_motor(0,0,0,0,sp,0);
#define trn_cc_nw(sp) set_motor(0,0,0,0,sp,sp);
void set_motor(char m1, char m2, char m3, char sp1, char sp2, char sp3);
#endif /* MOTOR_H_ */