From 3bc36b2ba818fa9384673f07b175948ec8c25309 Mon Sep 17 00:00:00 2001 From: ducoterra Date: Sat, 8 Feb 2025 20:59:49 -0500 Subject: [PATCH] serial transmit actually working --- Feather9x_TX_RX_serial/Feather9x_TX_RX_serial.ino | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Feather9x_TX_RX_serial/Feather9x_TX_RX_serial.ino b/Feather9x_TX_RX_serial/Feather9x_TX_RX_serial.ino index 6664264..8eec1b7 100644 --- a/Feather9x_TX_RX_serial/Feather9x_TX_RX_serial.ino +++ b/Feather9x_TX_RX_serial/Feather9x_TX_RX_serial.ino @@ -59,12 +59,13 @@ const byte numChars = RH_RF95_MAX_MESSAGE_LEN; char receivedChars[numChars]; void loop() { - strcpy(receivedChars, ""); + memset(receivedChars, '\0', sizeof(receivedChars)); int dataReceived = 0; + int ndx = 0; while (Serial.available() > 0) { dataReceived = 1; - static byte ndx = 0; + // read the incoming byte: incomingByte = Serial.read(); // say what you got: @@ -74,13 +75,13 @@ void loop() { if (dataReceived) { dataReceived = 0; - Serial.print("I received: "); - Serial.println(receivedChars); + Serial.print("Trying to send: "); + Serial.print(receivedChars); // Transmit code - Serial.println("Transmitting..."); // Send a message to rf95_server + // Serial.println("Transmitting..."); // Send a message to rf95_server - Serial.print("Sending "); Serial.println(receivedChars); + // Serial.print("Sending "); Serial.println(receivedChars); // Serial.println("Sending..."); delay(10); rf95.send((uint8_t *)receivedChars, RH_RF95_MAX_MESSAGE_LEN);