Advertisement
Guest User

TRYING

a guest
Mar 28th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.64 KB | None | 0 0
  1. #include <SPI.h>
  2. #include <WiFi.h>
  3. #include <WiFiUdp.h>
  4.  
  5. unsigned int localPort = 50505;      // local port to listen on
  6.  
  7. IPAddress remote_ip(192, 168, 1, 100);
  8. unsigned int remote_port = 50505;
  9.  
  10. WiFiUDP Udp;
  11.  
  12. void setup() {
  13.  
  14.   Serial.println("\nStarting connection to server...");
  15.   // if you get a connection, report back via serial:
  16.   Udp.begin(localPort);  
  17. }
  18.  
  19. void loop() {
  20.  
  21.  int bite_send;
  22.  Udp.beginPacket(remote_ip, remote_port);
  23.  bite_send = Udp.print("hello");
  24.  
  25.  if(!Udp.endPacket()){
  26.     Serial.println("packet failed");}
  27.  else {
  28.     Serial.println("packet sent");}
  29.  
  30.  Serial.println(bite_send);
  31.  
  32.  
  33.   delay(1000);
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement