Hi, I'm new to arduino and this is my first project. What I intend to do is to send data recorded from a potentiometer attached to analog pin 3 through UDP with ethernet shield to IP and port, then listen to that data from the computer side. The problem is I can't seem to read any data from my computer side,
I've tried many packets monitoring programs like wireshark, putty teraterm and I can't figure out whether the program is written wrongly or I am not using the right method to listen to the UDP packets.
Therefore I am hoping to find some help here to verify that my program is correct, so that I can isolate the problem. Any advice is welcome, please help. Thank you very much!
#include <SPI.h>
#include <Ethernet.h>
#include <EthernetUdp.h>
EthernetUDP Udp;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED }; //physical mac address
//the IP address assigned to arduino, found using a IP find program
IPAddress ip(155, 69, 133, 106);
unsigned int localPort = 8888;
//IP address assigned to my computer, found using commandprompt/ipconfig
IPAddress DestinationAddress(155, 69, 133, 85);
unsigned int DestinationPort = 8888;
int analogPin = 3;
int val[10];
int counter = 0;
void setup() {
// start the Ethernet and UDP:
Ethernet.begin(mac, ip);
Udp.begin(localPort);
Serial.begin(9600);
}
void loop()
{
for (int x=0; x <10; x++){
val[x] = analogRead(analogPin); // read the input pin
counter=counter+1;
delay(50);
}
if (counter>9)
{
for(int i = 0; i < 10; i++)
{
Serial.println(val*);*
- Udp.beginPacket(DestinationAddress, DestinationPort);*
_ Udp.println(val*);_
_ Udp.endPacket();_
_ }_
_ counter=0;_
_ }*_
}