satan wins

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

View File

@@ -57,10 +57,14 @@ 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: ");
}
void loop() {
int ndx = 0; int ndx = 0;
while (Serial.available() == 0) {} if (chatName[0] == '\0'){
while (Serial.available() > 0) { while (Serial.available() > 0) {
// read the incoming byte: // read the incoming byte:
incomingByte = Serial.read(); incomingByte = Serial.read();
@@ -68,6 +72,7 @@ void setup() {
chatName[ndx] = incomingByte; chatName[ndx] = incomingByte;
ndx++; ndx++;
} }
if (chatName[0] != '\0'){
char send_name[RH_RF95_MAX_MESSAGE_LEN] = ""; char send_name[RH_RF95_MAX_MESSAGE_LEN] = "";
strcpy(send_name, chatName); strcpy(send_name, chatName);
strcat(send_name, " has joined the chat!"); strcat(send_name, " has joined the chat!");
@@ -76,14 +81,12 @@ void setup() {
Serial.println(chatName); Serial.println(chatName);
rf95.send((uint8_t *)send_name, RH_RF95_MAX_MESSAGE_LEN); rf95.send((uint8_t *)send_name, RH_RF95_MAX_MESSAGE_LEN);
} }
}
void loop() {
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: