Arduino udp and processing udp

using udp library of arduino turn on and off a led using udp.read

OK

i have made a processing based guy which uses udp library . The GUI sends data over ethernet and then it is monitored on serial monitor of the arduino uno. The received data is sent on serial monitor like this:-

Udp.read(packetBuffer, UDP_TX_PACKET_MAX_SIZE); Serial.println("Contents:"); Serial.println(packetBuffer);

if (packetBuffer=="a") { digitalWrite(5,HIGH); } else { digitalWrite(5,LOW); }

the thing is , the data received is shown on serial monitor but doesn't works for if statement used in the code. if the arduino receives "a" from GUI through ethernet the led should glow on pin 5. Request to get help ASAP

Try:

if(packetBuffer[0]=='a')

it's not working. i tried to use the hex value of A i.e 0x41 it worked . now i am trying to use the processing gui to communicate with different arduinos with different ip address. i have tried to use the controlp5 library of processing to set the ip address to send and read the data sent through gui. i want to set the ip by writing the ip address in the text box of GUI request to get help ASAP

Bear in mind that 'A' (0x41) does not equal 'a' (0x61).

yeah instead of 'a' i am sending 'A'. its okay but the guy problem is still there . how to designate ip in guy for multiple arduino

kulkarnipurvesh: but the guy problem is still there . how to designate ip in guy for multiple arduino

I think you mean Graphical User Interface (GUI), not 'guy'.

Are you asking how to design and implement your Processing application so that it sends UDP traffic to multiple Arduinos, each specified by an IP address?

yes, sorry it was gui not guy. yes i am trying to do the same.

Well i have solved that problem .
thanks for the help guys .
But now there is an another problem.
I want to convert the data recieved by the processing using udp to string.
Here is the sketch:-

void receive( byte data, String ip, int port ) {

for(int i=0; i < data.length; i++)
print(char(data*)); *
println();
}
Basically the the data recieved in shown with the help of print but i want to show it on the gui. by using
text(datarecived,100,100);

kulkarnipurvesh: I want to convert the data recieved by the processing using udp to string.

That sounds like a question for a Processing forum.

here is the sketch attached.