Could you help me when IT cannot??
in
Integration and Hardware
•
1 year ago
IT here is in complete disarray, no one seems to know exactly how our network communicates and therefor have been completely useless to me. At home my arduino w/ethernet shield can easily run the UDPSendReceiveString example sketch, but here at work only my arduino can hear the Processing, and not the other way around.
If you have any suggestions to look into for the UDP and/or if you know how I can take the above code from 25 and understand it to use it I would be very appreciative.
I have gone through and turned off every firewall I can find, including creating a ruled exception for anything arduino related. That has had no impact.
I then made the arduino into its own server, and have tried to get my Processing sketch to control/read the arduino. This partially works as the arduino listens to the Processing sketch and responds, but I do not know how to turn the objects Processing sees into letters or numbers successfully.
The arduino sketch does a client.print() of chars and ints. Below is the processing part that reads the objects:
- void brakeControl()
- {
- try {
- URL url = new URL("http://192.168.16.175/?/"+(pin));
- BufferedInputStream bufferedInput = new BufferedInputStream( url.openStream() );
- println(bufferedInput.read());
- //url = new URL("http://192.168.16.175/?/");
- int byteValue = 0;
- String textline = "";
- while( (byteValue = bufferedInput.read()) >= 0) {
- if( byteValue != 10 ){ // 10 ... line break
- textline += char(byteValue);
- }
- else {
- lines.add(textline);
- textline = "";
- }
- }
- bufferedInput.close();
- }
- catch (IOException e) {}
- print(count);
- print(" : ");
- println(lines.get(count-1));
- }
The println of line 25 displays the words perfectly.
Thanks
1