satan wins

This commit is contained in:
2025-02-08 21:56:11 -05:00
parent f9867c1844
commit bcfc3462fc

View File

@@ -57,33 +57,36 @@ void setup() {
// If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then // If you are using RFM95/96/97/98 modules which uses the PA_BOOST transmitter pin, then
// you can set transmitter powers from 5 to 23 dBm: // you can set transmitter powers from 5 to 23 dBm:
rf95.setTxPower(23, false); rf95.setTxPower(23, false);
Serial.println("Please enter your name: "); Serial.println("Please enter your name: ");
int ndx = 0;
while (Serial.available() == 0) {}
while (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
chatName[ndx] = incomingByte;
ndx++;
}
char send_name[RH_RF95_MAX_MESSAGE_LEN] = "";
strcpy(send_name, chatName);
strcat(send_name, " has joined the chat!");
Serial.print("Welcome ");
Serial.println(chatName);
rf95.send((uint8_t *)send_name, RH_RF95_MAX_MESSAGE_LEN);
} }
void loop() { void loop() {
int ndx = 0;
if (chatName[0] == '\0'){
while (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
// say what you got:
chatName[ndx] = incomingByte;
ndx++;
}
if (chatName[0] != '\0'){
char send_name[RH_RF95_MAX_MESSAGE_LEN] = "";
strcpy(send_name, chatName);
strcat(send_name, " has joined the chat!");
Serial.print("Welcome ");
Serial.println(chatName);
rf95.send((uint8_t *)send_name, RH_RF95_MAX_MESSAGE_LEN);
}
}
memset(receivedChars, '\0', sizeof(receivedChars)); memset(receivedChars, '\0', sizeof(receivedChars));
int dataReceived = 0; int dataReceived = 0;
int ndx = 0;
while (Serial.available() > 0) { while (Serial.available() > 0 && chatName[0] != '\0') {
dataReceived = 1; dataReceived = 1;
// read the incoming byte: // read the incoming byte: