satan wins
This commit is contained in:
@@ -57,33 +57,36 @@ void setup() {
|
||||
// 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:
|
||||
rf95.setTxPower(23, false);
|
||||
|
||||
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() {
|
||||
|
||||
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));
|
||||
|
||||
int dataReceived = 0;
|
||||
int ndx = 0;
|
||||
|
||||
while (Serial.available() > 0) {
|
||||
while (Serial.available() > 0 && chatName[0] != '\0') {
|
||||
dataReceived = 1;
|
||||
|
||||
// read the incoming byte:
|
||||
|
||||
Reference in New Issue
Block a user