Advertisement
Guest User

Untitled

a guest
Sep 15th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. // UDP data transmission
  3. String hostip   = "192.168.1.58";             // describes where the UDP packet is send to
  4. String udpport  = "8080";                    // port of the UDP packet
  5.  
  6. String msg = "Staaaart !!!";
  7.  
  8. float V, X, Y;
  9.  
  10. void setup() {
  11.    
  12.   Serial.begin(115200);
  13.   delay(1000);
  14.   Serial.println("Zaczynam wysylac dane po UDP");
  15.  
  16.   // send to UDP
  17.   String msgUdp =  "SendToUDP " + hostip + " " + udpport + " " + msg;
  18.  
  19.   Serial.println(msgUdp);
  20. }
  21.  
  22. void loop() {
  23.  
  24.   X = random (70) * 0.15;
  25.   Y = random (70) * 0.15;
  26.   V = random (20,50) * 0.15;
  27.  
  28.  // send to UDP
  29.  // Ramka : TAG%X=1.5&y=2.3&V=3.88
  30.   String msgUdp =  "SendToUDP " + hostip + " " + udpport + " " +"TAG%" + "X="+X + "Y="+Y + "V="+V;
  31.   delay(500);
  32.   Serial.println(msgUdp);
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement