-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserial_com2Arduino2.ino
More file actions
56 lines (40 loc) · 985 Bytes
/
serial_com2Arduino2.ino
File metadata and controls
56 lines (40 loc) · 985 Bytes
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
#define Sensor1 55
#define Sensor2 25
typedef struct {
int x;
int y;
}Point;
typedef struct{
// arrangment is important our value list
struct structVal{
int x;
int y;
};
int16_t val;
int16_t other_val;
int16_t other_val2;
Point point;
structVal stcVal;
// checksum is bellow must be
uint16_t checksum;
} SerialCommand;
SerialCommand Command;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
}
void loop() {
// put your main code here, to run repeatedly:
Command.val=(int16_t)15;
Command.other_val=(int16_t)42;
Command.other_val2=(int16_t)16;
//Command.a=(int16_t)"Hello World";
//Command.checksum = (uint16_t)(Command.val^ Command.other_val ^ Command.other_val2);
Command.point.x=11;
Command.point.y=12;
Command.stcVal.x=21;
Command.stcVal.y=22;
Command.checksum=(uint16_t)Sensor1;
Serial.write((uint8_t *) &Command, sizeof(Command));
Serial.println();
}