Skip to content

Instantly share code, notes, and snippets.

@companje
Created April 2, 2014 09:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save companje/9930738 to your computer and use it in GitHub Desktop.
Save companje/9930738 to your computer and use it in GitHub Desktop.
UDP test
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
EthernetUDP udp;
void setup() {
byte mac[] = { 0x90, 0xA2, 0xDA, 0x0F, 0x36, 0x7D }; //MAC address of Arduino Ethernet
IPAddress ip(192, 168, 2, 177); //static IP-address of Arduino Ethernet
Ethernet.begin(mac,ip);
udp.begin(8888); // local port to listen on
}
void loop() {
udp.beginPacket("192.168.2.123",8888);
udp.write("Hello World!\n");
udp.endPacket();
delay(500);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment