File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
examples/h_SDI-12_slave_implementation Expand file tree Collapse file tree 1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -39,6 +39,7 @@ int state = 0;
39
39
#define WAIT 0
40
40
#define INITIATE_CONCURRENT 1
41
41
#define INITIATE_MEASUREMENT 2
42
+ #define PROCESS_COMMAND 3
42
43
43
44
// Create object by which to communicate with the SDI-12 bus on SDIPIN
44
45
SDI12 slaveSDI12 (DATA_PIN);
@@ -196,6 +197,7 @@ void loop() {
196
197
// Character '!' indicates the end of an SDI-12 command; if the current
197
198
// character is '!', stop listening and respond to the command
198
199
if (charReceived == ' !' ) {
200
+ state = PROCESS_COMMAND;
199
201
// Command string is completed; do something with it
200
202
parseSdi12Cmd (commandReceived, dValues);
201
203
// Clear command string to reset for next command
@@ -246,5 +248,9 @@ void loop() {
246
248
slaveSDI12.forceListen (); // sets SDI-12 pin as input to prepare for incoming
247
249
// message AGAIN
248
250
break ;
251
+ case PROCESS_COMMAND:
252
+ state = WAIT;
253
+ slaveSDI12.forceListen ();
254
+ break ;
249
255
}
250
256
}
You can’t perform that action at this time.
0 commit comments