-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserialcontrol.ino
16 lines (16 loc) · 1.11 KB
/
serialcontrol.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
void serialcontrol()
{
// check rs232 connection
do
{
t = Serial.read(); // this is to empty the input buffer when starting reading data from radio,
} while (Serial.available() > 0); // buffer contains erratic data when the radio is switched on (fix power up sequence)
Serial.print("TX;"); // send CAT command to the radio, ask for TX status
get_radio_response(); // call routine to read from radio
if (CAT_buffer.startsWith("TX")) { // if the answer is correct (it should start with TX)
constatus = true; // connection status is ok, green light must be turned on
}
else { // we do not get a (correct-) answer
constatus = false; // red light must be turned on, no connection with radio, bad data/baudrate or radio powered off
}
}