PaulS:
Which once again you haven't provided a link to.
Link to iBoard: https://www.itead.cc/wiki/IBoard_Ex
Code for iBoard:
#include <SPI.h>
#include <Ethernet.h>
#include < EthernetUdp.h >
byte mac[] = {__, __, __, __, __, __}; // MAC address of controller
IPAddress ip (192,168,1,21); // ip of pc
unsigned int localPort = 43770; // local port to listen on
// buffers for receiving and sending data (need to change to send bytes instead of char)
char packetBuffer [UDP_TX_PACKET_MAX_SIZE]; // buffer to hold incoming packet
char replyBuffer[] = “acknowledged”; // a string to send back
EthernetUDP Udp; // an EthernetUDP instance to let us send and receive packets over UDP
void setup(){
Serial.begin(115200);
Ethernet.begin (mac, ip); // Start Ethernet connection
Udp.begin (localPort); // Start UDP
}
void loop(){
// if data available, read a packet
int packetSize = Udp.parsePacket();
if (packetSize){
Serial.print (“Received packet of size “);
Serial.println (packetSize);
Serial.print (“From “);
IPAddress remote = Udp.remoteIP();
for (int i=0; i<4; i++){
Serial.print (remote[i], DEC);
if (i<3){
Serial.print(“ “);
}
}
Serial.print (“, port”);
Serial.println (Udp.remotePort());
// read the packet into packetBuffer
Udp.read (packetBuffer, UDP_TX_PACKET_MAX_SIZE);
Serial.println (“Contents “);
Serial.println (packetBuffer);
// send a reply to the IP address and port that sent us the packet we received
Udp.beginPacket (Udp.remoteIP(), Udp.remotePort());
Udp.write (replyBuffer);
Udp.endPacket();
}
delay(10);
}
Code for processing:
import hypermedia.net.*; // import the UDP library
UDP udp; // define the UDP object
void setup(){
udp = new UDP (this, 43770); // create a new datagram connection on port 43770
udp.listen (true); // and wait for incoming message
}
void draw(){
}
void keyPressed(){
int destPort = 43770;
String ip = “255.255.255.255”; // broadcast message
udp.send (“Hello World\n”, ip, destPort); // the message to send
}
void receive (byte[] data){
// print the incoming data bytes as ASCII characters
for (int i=0; i<data.length; i++) {
print (char (data[i]));
}
println();
}