serial transmit actually working

This commit is contained in:
2025-02-08 20:59:49 -05:00
parent 223a5270e7
commit 3bc36b2ba8

View File

@@ -59,12 +59,13 @@ const byte numChars = RH_RF95_MAX_MESSAGE_LEN;
char receivedChars[numChars]; char receivedChars[numChars];
void loop() { void loop() {
strcpy(receivedChars, ""); memset(receivedChars, '\0', sizeof(receivedChars));
int dataReceived = 0; int dataReceived = 0;
int ndx = 0;
while (Serial.available() > 0) { while (Serial.available() > 0) {
dataReceived = 1; dataReceived = 1;
static byte ndx = 0;
// read the incoming byte: // read the incoming byte:
incomingByte = Serial.read(); incomingByte = Serial.read();
// say what you got: // say what you got:
@@ -74,13 +75,13 @@ void loop() {
if (dataReceived) { if (dataReceived) {
dataReceived = 0; dataReceived = 0;
Serial.print("I received: "); Serial.print("Trying to send: ");
Serial.println(receivedChars); Serial.print(receivedChars);
// Transmit code // 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); // Serial.println("Sending..."); delay(10);
rf95.send((uint8_t *)receivedChars, RH_RF95_MAX_MESSAGE_LEN); rf95.send((uint8_t *)receivedChars, RH_RF95_MAX_MESSAGE_LEN);