Now we’re looking at Wake On Radio (WOR) and power-saving, one of the essential features of our E22 UART LoRa device based on popular Semtech’s SX1262, SX1268 RF chips.
Ebyte LoRa E22 power-saving WOR and structured data
Then we’ll understand how to manage complex structures that are better optimized than string format data.
Here a selection of LoRa devices AliExpress (433MHz 5.5Km) - AliExpress (433MHz 10Km) - AliExpress (868MHz 915Mhz 5.5Km) - AliExpress (868MHz 915Mhz 10Km)
If you have trouble with the device freeze , you must put a pull-up 4.7k resistor or better connect to the device AUX pin.
sx1278 sx1276 wireless lora uart module serial 3000m arduino 433 rf
These devices, respect E32 and E220 have a different management of WOR and sleep, you must set M0 and M1 for receiver and sender at the same manner.
Mode M1 M0 Explanation Normal 0 0 UART and wireless channel are open, transparent transmission is on (Supports configuration over air via special command) WOR Mode 0 1 Can be defined as WOR transmitter and WOR receiver Configuration mode 1 0 Users can access the register through the serial port to control the working state of the module Deep sleep mode 1 1 Sleep mode
So we need to connect the sending device in WOR mode.
Ebyte LoRa E22 Arduino UNO WOR mode connection
Ebyte LoRa E22 Wemos D1: WOR mode connection
LoRa E22 ESP32 DEV KIT V1 WOR mode breadboard
Ebyte LoRa E22 Arduino Nano 33 IoT WOR mode connection
LoRa E22 Arduino MKR WiFi 1010: WOR mode connection
WOR Cycle
A critical configuration parameter is WOR Cycle, for the sender is essential because It adds a long preamble to the message (long as wake time), the receiver use wake time as a pull interval time check. So if the receiver checks every 2000ms (polling time) if there is a message, the sender adds a 2000ms preamble. The receiver intercepts the message preamble, waits for the actual message to read It, and returns to power save mode.
So If you want to maximize the power save, you must put minimal WOR Cycle. If you want more efficiency, you must do the inverse.
The sender and receiver in this device must have the same WOR Cycle.
Here is the configuration for the WOR transmitter:
configuration.ADDL
=
0x02
;
configuration.ADDH
=
0x00
;
configuration.NETID
=
0x00
;
configuration.CHAN
=
23
;
configuration.SPED.uartBaudRate
=
UART_BPS_9600;
configuration.SPED.airDataRate
=
AIR_DATA_RATE_010_24;
configuration.SPED.uartParity
=
MODE_00_8N1;
configuration.OPTION.subPacketSetting
=
SPS_240_00;
configuration.OPTION.RSSIAmbientNoise
=
RSSI_AMBIENT_NOISE_DISABLED;
configuration.OPTION.transmissionPower
=
POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI
=
RSSI_DISABLED;
configuration.TRANSMISSION_MODE.fixedTransmission
=
FT_FIXED_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableRepeater
=
REPEATER_DISABLED;
configuration.TRANSMISSION_MODE.enableLBT
=
LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORTransceiverControl
=
WOR_TRANSMITTER;
configuration.TRANSMISSION_MODE.WORPeriod
=
WOR_2000_011;
Sending sketch:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#define
DESTINATION_ADDL
3
#include
"Arduino.h"
#include
"LoRa_E22.h"
LoRa_E22 e22ttl(
&
Serial1,
2
,
4
,
6
);
void
setup
() {
Serial.begin
(
9600
);
delay
(
500
);
e22ttl.begin();
e22ttl.setMode(MODE_1_WOR);
Serial.println
(
"Hi, I'm going to send message!"
);
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
"Hello, world?"
);
Serial.println
(rs.getResponseDescription());
e22ttl.setMode(MODE_0_NORMAL);
}
void
loop
() {
if
(e22ttl.available()>
1
) {
#ifdef
ENABLE_RSSI
ResponseContainer rc
=
e22ttl.receiveMessageRSSI();
#else
ResponseContainer rc
=
e22ttl.receiveMessage();
#endif
if
(rc.status.code
!
=
1
){
Serial.println
(rc.status.getResponseDescription());
}
else
{
Serial.println
(rc.status.getResponseDescription());
Serial.println
(rc.data);
#ifdef
ENABLE_RSSI
Serial.print
(
"RSSI: "
);
Serial.println
(rc.rssi, DEC);
#endif
}
}
if
(
Serial.available
()) {
String input
=
Serial.readString();
ResponseStatus rsSend
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
"We have received the message!"
);
Serial.println
(rsSend.getResponseDescription());
}
}
Now the receiver configuration:
configuration.ADDL
=
0x03
;
configuration.ADDH
=
0x00
;
configuration.NETID
=
0x00
;
configuration.CHAN
=
23
;
configuration.SPED.uartBaudRate
=
UART_BPS_9600;
configuration.SPED.airDataRate
=
AIR_DATA_RATE_010_24;
configuration.SPED.uartParity
=
MODE_00_8N1;
configuration.OPTION.subPacketSetting
=
SPS_240_00;
configuration.OPTION.RSSIAmbientNoise
=
RSSI_AMBIENT_NOISE_DISABLED;
configuration.OPTION.transmissionPower
=
POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI
=
RSSI_DISABLED;
configuration.TRANSMISSION_MODE.fixedTransmission
=
FT_FIXED_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableRepeater
=
REPEATER_DISABLED;
configuration.TRANSMISSION_MODE.enableLBT
=
LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORTransceiverControl
=
WOR_RECEIVER;
configuration.TRANSMISSION_MODE.WORPeriod
=
WOR_2000_011;
esp32 DOIT DEV KIT v1 EByte LoRa E32 shield main
And receiving sketch with wake up for ESP32:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#define
DESTINATION_ADDL
2
#include
"Arduino.h"
#include
"LoRa_E22.h"
#include
<WiFi.h>
#include
"soc/rtc_cntl_reg.h"
#include
"soc/rtc.h"
#include
"driver/rtc_io.h"
#define
FPM_SLEEP_MAX_TIME
0xFFFFFFF
void
callback() {
Serial.println
(
"Callback"
);
Serial.flush
();
}
LoRa_E22 e22ttl(
&
Serial2,
15
,
21
,
19
);
void
setup
()
{
Serial.begin
(
9600
);
while
(
!
Serial) {
;
}
delay
(
100
);
e22ttl.begin();
e22ttl.setMode(MODE_1_WOR);
delay
(
1000
);
Serial.println
();
Serial.println
(
"Start sleep!"
);
delay
(
100
);
esp_sleep_enable_ext0_wakeup(GPIO_NUM_15,
LOW
);
Serial.println
(
"Going to sleep now"
);
delay
(
100
);
esp_light_sleep_start();
delay
(
1
);
Serial.println
();
Serial.println
(
"Wake and start listening!"
);
}
void
loop
()
{
if
(e22ttl.available() >
1
){
Serial.println
(
"Message arrived!"
);
#ifdef
ENABLE_RSSI
ResponseContainer rs
=
e22ttl.receiveMessageRSSI();
#else
ResponseContainer rs
=
e22ttl.receiveMessage();
#endif
String message
=
rs.data;
Serial.println
(rs.status.getResponseDescription());
Serial.println
(message);
e22ttl.setMode(MODE_0_NORMAL);
delay
(
1000
);
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
"We have received the message!"
);
}
}
Pay attention in this receiver sketch only the LoRa E220 go in sleep mode, so in a real example, you must manage the sleep of the microcontroller. In the following articles, we will check the deep sleep of every microcontroller with detailed examples.
Send complex structure
To send and receive, you must set the normal mode; if you make a complete connection, the library does the correct setting automatically.
Ebyte LoRa E32 E22 E220 Arduino UNO normal mode breadboard
M0 GND (Set normal mode) M1 GND (Set normal mode) TX PIN 2 (PullUP 4,7KΩ) RX PIN 3 (PullUP 4,7KΩ & Voltage divider) AUX Not connected (PullUP 4,7KΩ) VCC 5v GND GND
and this configuration for Wemos D1 mini:
Ebyte LoRa E32 E22 E220 Wemos D1 normal mode breadboard
M0 GND (Set normal mode) M1 GND (Set normal mode) TX PIN D2 (PullUP 4,7KΩ) RX PIN D3 (PullUP 4,7KΩ) AUX Not connected (PullUP 4,7KΩ) VCC 3.3v/5v GND GND
ESP-32:
Ebyte LoRa E32 E22 E220 ESP32 DEV KIT V1 normal mode breadboard
M0 GND (Set normal mode) M1 GND (Set normal mode) RX TX2 (PullUP 4,7KΩ) TX RX2 (PullUP 4,7KΩ) AUX Not connected (PullUP 4,7KΩ) VCC 3.3v/5v GND GND
Arduino MKR WiFi 1010:
Ebyte LoRa Exx Arduino MKR WiFi 1010 normal mode connected breadboard
We can use string as we want, use It as JSON format, and so on, but if you’re going to use structured messages in native mode (byte array) It’s more efficient.
The example code for the sender can be:
1
2
3
4
5
6
7
8
9
10
11
12
struct Message {
char
type[
5
];
char
message[
8
];
float
temperature;
};
struct Message message
=
{
"TEMP"
, ROOM,
19.2
};
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(Message));
Serial.println
(rs.getResponseDescription());
and to receive:
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
if
(e22ttl.available()>
1
) {
#ifdef
ENABLE_RSSI
ResponseStructContainer rsc
=
e22ttl.receiveMessageRSSI(
sizeof
(Message));
#else
ResponseStructContainer rsc
=
e22ttl.receiveMessage(
sizeof
(Message));
#endif
if
(rsc.status.code
!
=
1
){
Serial.println
(rsc.status.getResponseDescription());
}
else
{
Serial.println
(rsc.status.getResponseDescription());
struct Message message
=
*
(Message
*
) rsc.data;
Serial.println
(message.type);
Serial.println
(message.message);
Serial.println
(message.temperature);
#ifdef
ENABLE_RSSI
Serial.print
(
"RSSI: "
);
Serial.println
(rsc.rssi, DEC);
#endif
}
}
To manage Sender and Receiver, you can use the FIXED SENDER and FIXED RECEIVER configuration:
Sender:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
configuration.ADDL
=
0x02
;
configuration.ADDH
=
0x00
;
configuration.NETID
=
0x00
;
configuration.CHAN
=
23
;
configuration.SPED.uartBaudRate
=
UART_BPS_9600;
configuration.SPED.airDataRate
=
AIR_DATA_RATE_010_24;
configuration.SPED.uartParity
=
MODE_00_8N1;
configuration.OPTION.subPacketSetting
=
SPS_240_00;
configuration.OPTION.RSSIAmbientNoise
=
RSSI_AMBIENT_NOISE_DISABLED;
configuration.OPTION.transmissionPower
=
POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI
=
RSSI_DISABLED;
configuration.TRANSMISSION_MODE.fixedTransmission
=
FT_FIXED_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableRepeater
=
REPEATER_DISABLED;
configuration.TRANSMISSION_MODE.enableLBT
=
LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORTransceiverControl
=
WOR_TRANSMITTER;
configuration.TRANSMISSION_MODE.WORPeriod
=
WOR_2000_011;
And you must uncomment the relative define in the sketch:
1
2
3
#define
DESTINATION_ADDL
3
#define
ROOM
"Kitchen"
Receiver:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
configuration.ADDL
=
0x03
;
configuration.ADDH
=
0x00
;
configuration.NETID
=
0x00
;
configuration.CHAN
=
23
;
configuration.SPED.uartBaudRate
=
UART_BPS_9600;
configuration.SPED.airDataRate
=
AIR_DATA_RATE_010_24;
configuration.SPED.uartParity
=
MODE_00_8N1;
configuration.OPTION.subPacketSetting
=
SPS_240_00;
configuration.OPTION.RSSIAmbientNoise
=
RSSI_AMBIENT_NOISE_ENABLED;
configuration.OPTION.transmissionPower
=
POWER_22;
configuration.TRANSMISSION_MODE.enableRSSI
=
RSSI_DISABLED;
configuration.TRANSMISSION_MODE.fixedTransmission
=
FT_FIXED_TRANSMISSION;
configuration.TRANSMISSION_MODE.enableRepeater
=
REPEATER_DISABLED;
configuration.TRANSMISSION_MODE.enableLBT
=
LBT_DISABLED;
configuration.TRANSMISSION_MODE.WORTransceiverControl
=
WOR_RECEIVER;
configuration.TRANSMISSION_MODE.WORPeriod
=
WOR_2000_011;
And you must uncomment the relative define in the sketch
1
2
3
#define
DESTINATION_ADDL
2
#define
ROOM
"Bathroo"
Complete sender and receiver sketch:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#define
DESTINATION_ADDL
3
#define
ENABLE_RSSI
true
#include
"Arduino.h"
#include
"LoRa_E22.h"
LoRa_E22 e22ttl(
&
Serial2,
15
,
21
,
19
);
struct Message {
char
type[
5
];
char
message[
8
];
byte
temperature[
4
];
} message;
void
setup
() {
Serial.begin
(
9600
);
delay
(
500
);
e22ttl100.begin();
Serial.println
(
"Hi, I'm going to send message!"
);
struct Message {
char
type[
5
]
=
"TEMP"
;
char
message[
8
]
=
"Kitchen"
;
byte
temperature[
4
];
} message;
*
(
float
*
)(message.temperature)
=
19.2
;
ResponseStatus rs
=
e22ttl100.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(Message));
Serial.println
(rs.getResponseDescription());
}
void
loop
() {
if
(e22ttl100.available()>
1
) {
#ifdef
ENABLE_RSSI
ResponseStructContainer rsc
=
e22ttl100.receiveMessageRSSI(
sizeof
(Message));
#else
ResponseStructContainer rsc
=
e22ttl100.receiveMessage(
sizeof
(Message));
#endif
if
(rsc.status.code
!
=
1
){
Serial.println
(rsc.status.getResponseDescription());
}
else
{
Serial.println
(rsc.status.getResponseDescription());
struct Message message
=
*
(Message
*
) rsc.data;
Serial.println
(message.type);
Serial.println
(message.message);
Serial.println
(
*
(
float
*
)(message.temperature));
#ifdef
ENABLE_RSSI
Serial.print
(
"RSSI: "
);
Serial.println
(rsc.rssi, DEC);
#endif
}
}
if
(
Serial.available
()) {
struct Message {
char
type[
5
]
=
"TEMP"
;
char
message[
8
]
=
"Kitchen"
;
byte
temperature[
4
];
} message;
*
(
float
*
)(message.temperature)
=
Serial.parseFloat();
ResponseStatus rs
=
e22ttl100.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(Message));
Serial.println
(rs.getResponseDescription());
}
}
But real life is not so simple, and probably you have multiple sensors with different structures in your home, so you need to receive various structures. A possible solution is to read the first part of the structure and instantiate the rest as you want.
Arduino MKR WiFi 1010 on breadboard with Ebyte LoRa E22
Read a piece of structure
So if you would have the TYPE of structure you are going to read:
1
2
3
4
char
type[
5
];
ResponseContainer rs
=
e22ttl.receiveInitialMessage(
sizeof
(type));
String typeStr
=
rs.data;
With this information, we can create specified structures from different devices, for example:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
struct MessageTemperature {
char
type[
5
];
char
message[
8
];
byte
temperature[
4
];
};
[...]
struct MessageTemperature messageT
=
{
"TEMP"
, ROOM,
0
};
*
(
float
*
)(messageT.temperature)
=
19.2
;
ResponseStatus rsT
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
messageT,
sizeof
(MessageTemperature));
Serial.println
(rsT.getResponseDescription());
or
1
2
3
4
5
6
7
8
9
10
11
12
13
struct MessageHumidity {
char
type[
5
];
char
message[
8
];
byte
humidity;
};
[...]
struct MessageHumidity message
=
{
"HUMI"
, ROOM,
80
};
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(MessageHumidity));
Serial.println
(rs.getResponseDescription());
And so you can load specified structure from the receiver:
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
if
(e22ttl.available() >
1
) {
char
type[
5
];
ResponseContainer rs
=
e220ttl.receiveInitialMessage(
sizeof
(type));
String typeStr
=
rs.data;
if
(rs.status.code
!
=
1
) {
Serial.println
(rs.status.getResponseDescription());
}
else
{
Serial.println
(typeStr);
if
(typeStr
=
=
"TEMP"
) {
struct MessageTemperaturePartial {
char
message[
8
];
byte
temperature[
4
];
};
ResponseStructContainer rsc
=
e22ttl.receiveMessage(
sizeof
(MessageTemperaturePartial));
struct MessageTemperaturePartial message
=
*
(MessageTemperaturePartial
*
) rsc.data;
Serial.println
(
*
(
float
*
)(message.temperature));
Serial.println
(message.message);
rsc.close();
}
else
if
(typeStr
=
=
"HUMI"
) {
struct MessageHumidityPartial {
char
message[
8
];
byte
humidity;
};
ResponseStructContainer rsc
=
e22ttl.receiveMessage(
sizeof
(MessageHumidityPartial));
struct MessageHumidityPartial message
=
*
(MessageHumidityPartial
*
) rsc.data;
Serial.println
(message.humidity);
Serial.println
(message.message);
rsc.close();
}
else
{
Serial.println
(
"Something goes wrong!!"
);
}
}
}
So with a sender sketches that send humidity and temperature, we can read the first part, the type, and execute the correct code to retrieve the rest of the data:
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
#define
MESSAGE_TYPE
"HUMI"
#define
DESTINATION_ADDL
3
#define
ROOM
"Kitchen"
#include
"Arduino.h"
#include
"LoRa_E22.h"
LoRa_E22 e22ttl(
&
Serial1,
2
,
4
,
6
);
struct MessageTemperature {
char
type[
5
];
char
message[
8
];
byte
temperature[
4
];
};
struct MessageHumidity {
char
type[
5
];
char
message[
8
];
byte
humidity;
};
void
setup
() {
Serial.begin
(
9600
);
while
(
!
Serial);
delay
(
500
);
e22ttl.begin();
Serial.println
(
"Hi, I'm going to send message!"
);
struct MessageHumidity message
=
{
"HUMI"
, ROOM,
80
};
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(MessageHumidity));
Serial.println
(rs.getResponseDescription());
delay
(
1000
);
struct MessageTemperature messageT
=
{
"TEMP"
, ROOM,
0
};
*
(
float
*
)(messageT.temperature)
=
19.2
;
ResponseStatus rsT
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
messageT,
sizeof
(MessageTemperature));
Serial.println
(rsT.getResponseDescription());
}
void
loop
() {
if
(e22ttl.available() >
1
) {
char
type[
5
];
ResponseContainer rs
=
e22ttl.receiveInitialMessage(
sizeof
(type));
String typeStr
=
rs.data;
if
(rs.status.code
!
=
1
) {
Serial.println
(rs.status.getResponseDescription());
}
else
{
Serial.println
(typeStr);
if
(typeStr
=
=
"TEMP"
) {
struct MessageTemperaturePartial {
char
message[
8
];
byte
temperature[
4
];
};
ResponseStructContainer rsc
=
e22ttl.receiveMessage(
sizeof
(MessageTemperaturePartial));
struct MessageTemperaturePartial message
=
*
(MessageTemperaturePartial
*
) rsc.data;
Serial.println
(
*
(
float
*
)(message.temperature));
Serial.println
(message.message);
rsc.close();
}
else
if
(typeStr
=
=
"HUMI"
) {
struct MessageHumidityPartial {
char
message[
8
];
byte
humidity;
};
ResponseStructContainer rsc
=
e22ttl.receiveMessage(
sizeof
(MessageHumidityPartial));
struct MessageHumidityPartial message
=
*
(MessageHumidityPartial
*
) rsc.data;
Serial.println
(message.humidity);
Serial.println
(message.message);
rsc.close();
}
else
{
Serial.println
(
"Something goes wrong!!"
);
}
}
}
if
(
Serial.available
()) {
if
(MESSAGE_TYPE
=
=
"HUMI"
) {
struct MessageHumidity message
=
{
"HUMI"
, ROOM,
0
};
message.humidity
=
Serial.parseInt();
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(MessageHumidity));
Serial.println
(rs.getResponseDescription());
}
else
{
struct MessageTemperature message
=
{
"TEMP"
, ROOM,
0
};
*
(
float
*
)(message.temperature)
=
Serial.parseFloat();
ResponseStatus rs
=
e22ttl.sendFixedMessage(
0
, DESTINATION_ADDL,
23
,
&
message,
sizeof
(MessageTemperature));
Serial.println
(rs.getResponseDescription());
}
}
}
Thanks
And this was the last part of my little tutorial. Next, we will examine the power saving of the microcontroller in detail, not only the LoRa device.
Ebyte LoRa E22 device for Arduino, esp32 or esp8266: settings and basic usage Ebyte LoRa E22 device for Arduino, esp32 or esp8266: library Ebyte LoRa E22 device for Arduino, esp32 or esp8266: configuration Ebyte LoRa E22 device for Arduino, esp32 or esp8266: fixed transmission, broadcast, monitor, and RSSI Ebyte LoRa E22 device for Arduino, esp32 or esp8266: power-saving and sending structured data Ebyte LoRa E22 device for Arduino, esp32 or esp8266: repeater mode and remote settings Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and Arduino shield Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and WeMos D1 shield Ebyte LoRa E22 device for Arduino, esp32 or esp8266: WOR microcontroller and esp32 dev v1 shield
Shield and PCB