Hi everybody.
I’ m trying to forward packets form Serial to Lora back and for.
Hacking from the Ping Pong example the RX packets get printed IN Serial as I wish.
But could not get Serail.available() to detect anything.
My suspicion is the interrupts are disable in the loop:
Any clue? Thanks in advance.
Lalo
This is the code:
void loop() {
if (Serial.available() > 0) {
c = Serial.read();
if (c == 13) {
txpacket[sptr] = 0;
state = TX;
} else {
if (c != ‘\n’ && sptr < (BUFFER_SIZE - 1)) {
txpacket[sptr++] = c;
}
}
}
switch (state) {
case TX:
Serial.printf("\r\nsending packet \"%s\" , length %d\r\n", txpacket, strlen(txpacket));
Radio.Send((uint8_t *)txpacket, strlen(txpacket));
state = LOWPOWER;
break;
case RX:
Serial.println("into RX mode");
Radio.Rx(0);
state = LOWPOWER;
break;
case LOWPOWER:
lowPowerHandler();
break;
default:
break;
}
Radio.IrqProcess();
}