I'm looking at doing a project for work and I'd like to run something by you experts to see if 1. it's feasible and 2. I'm on the right track.
Basically I want to take an analog voltage and I want to send that converted digital reading out a network shield to a known IP address where someone can read the data and store it in a server.
Doing a little research on the arduino website, I've come across this code:
http://arduino.cc/en/Tutorial/UDPSendReceiveString
Looking at the code in the loop, I see the following:
Code: Select all
void loop() {
// if there's 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 packetBufffer
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);
}
The server could "ping" the board and send back whatever data value is in the replybuffer....I think?
-Jim