Skip to content

Commit

Permalink
Update UDP_CalculateSendDelay.ino
Browse files Browse the repository at this point in the history
  • Loading branch information
M-ichae-l committed Jun 30, 2023
1 parent 3f41c9e commit 27a7227
Showing 1 changed file with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ int keyIndex = 0; // your network key Index number (needed onl
int status = WL_IDLE_STATUS; // Indicater of Wifi status

WiFiUDP Udp;
char server[] ="0.0.0.0";
String str_server;
char client_ip[] ="0.0.0.0";
String str_client_ip;
int port = 5001;

void setup() {
Expand All @@ -40,17 +40,17 @@ void setup() {

Serial.print("Enter client IP address, ");
while (Serial.available() == 0);
str_server = Serial.readString();
str_server.trim();
str_server.toCharArray(server, (str_server.length() + 1));
Serial.println(server);
str_client_ip = Serial.readString();
str_client_ip.trim();
str_client_ip.toCharArray(client_ip, (str_client_ip.length() + 1));
Serial.println(client_ip);
delay(5000);
}

char buf[256];
void loop() {
sprintf(buf, "%d", ((int)(millis())));
Udp.beginPacket(server, port);
Udp.beginPacket(client_ip, port);
Udp.write(buf);
Udp.endPacket();
delay(5);
Expand Down

0 comments on commit 27a7227

Please sign in to comment.