-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserial_com2Arduino.ino
More file actions
58 lines (41 loc) · 1.18 KB
/
serial_com2Arduino.ino
File metadata and controls
58 lines (41 loc) · 1.18 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
#define Sensor1 55
#define Sensor2 25
typedef struct{
int16_t val;
int16_t other_val;
int16_t other_val2;
uint16_t checksum;
//int16_t a;
} SerialCommand;
SerialCommand Command;
typedef struct{
int16_t val;
int16_t other_val;
int16_t other_val2;
uint16_t checksum;
//int16_t a;
} SerialCommand2;
SerialCommand2 Command2;
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)25;
//Command.a=(int16_t)"Hello World";
//Command.checksum = (uint16_t)(Command.val^ Command.other_val ^ Command.other_val2);
Command.checksum=(uint16_t)Sensor1;
Command2.val=(int16_t)30;
Command2.other_val=(int16_t)42;
Command2.other_val2=(int16_t)50;
//Command.a=(int16_t)"Hello World";
//Command2.checksum = (uint16_t)(Command2.val^ Command2.other_val ^ Command2.other_val2);
Command2.checksum=(uint16_t)Sensor2;
Serial.write((uint8_t *) &Command, sizeof(Command));
Serial.println();
Serial.write((uint8_t *) &Command2, sizeof(Command2));
Serial.println();
}