-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest.h
More file actions
59 lines (48 loc) · 1.12 KB
/
test.h
File metadata and controls
59 lines (48 loc) · 1.12 KB
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
51
52
53
54
55
56
57
58
59
#pragma once
#include <systemobject.h>
//TO:BS1~SYS:PINS~ACT:CHANGEPIN~V:50~PIN:0
class CTest:public CSystemObject{
public:
CTest(){ setInterval(100);}
void setup(){setState(_PLAY);
CMsg m;
m.set(_SYS,"PINS");
m.set(_ACT,"CHANGEPIN");
m.set(_VALUE,100.0);
m.set(_PIN,0);
addMessageList(m);
m.set(_PIN,2);
addMessageList(m);
}
void loop(){
CMsg m=getDataMap("IMUIGYRO");
if(m.Parameters.size()<3)
return;
m.writetoconsoleln();
//writeconsoleln(m.get("CLUSTER"));
float x=abs(m.get("X",0.0));
float y=abs(m.get("Y",0.0));
m.set(_SYS,"PINS");
m.set(_ACT,"CHANGEPIN");
if(x>.5){
m.set(_VALUE,100.0);
m.set(_PIN,0);
addMessageList(m);
}
else{
m.set(_VALUE,0.0);
m.set(_PIN,0);
addMessageList(m);
}
if(y>.5){
m.set(_VALUE,100.0);
m.set(_PIN,2);
addMessageList(m);
}
else{
m.set(_VALUE,0.0);
m.set(_PIN,2);
addMessageList(m);
}
}
};