Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <SPI.h>
- #include <WiFi.h>
- #include <WiFiUdp.h>
- unsigned int localPort = 50505; // local port to listen on
- IPAddress remote_ip(192, 168, 1, 100);
- unsigned int remote_port = 50505;
- WiFiUDP Udp;
- void setup() {
- Serial.println("\nStarting connection to server...");
- // if you get a connection, report back via serial:
- Udp.begin(localPort);
- }
- void loop() {
- int bite_send;
- Udp.beginPacket(remote_ip, remote_port);
- bite_send = Udp.print("hello");
- if(!Udp.endPacket()){
- Serial.println("packet failed");}
- else {
- Serial.println("packet sent");}
- Serial.println(bite_send);
- delay(1000);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement