Instructables

Does anyone know how to turn on an arduino pin with UDP packets over an ethernet sheild?

I am using an ArduinoEthernetSheild with arduino uno. I am making a switch to turn motors on and off.  I really need help with this project.
 
Thankyou.

maewert2 years ago
Essentially you need to create a UDP server on a particular port, say port 8080.
(We use these 'high' port numbers to stay away from the lower port numbers which are assigned to functions already, such as HTTP which uses port 80.)

Review the Ethernet library calls for the UDP server functions to get the specific functions.

Your protocol could be very simple, a one byte message can turn on or off 8 bits of your arduino. Your code would check to see if any new data is received, receive the one byte, set the output pins accordingly, optionally sending back a short message to the client indicating 'Got it'. Of course then you need some program to send the UDP packets for hte arduino to respond to, but you didn't tell us how you were sending the packets, you said using UDP but did you mean using a web page to generate the packets in which case you would want to use a TCP based web server on the arduino and serve a web page giving the user maybe checkboxes to enable and disable pins, then you read the data posted back to the arduino.

Best Wishes.
Pro

Get More Out of Instructables

Already have an Account?

close

PDF Downloads
As a Pro member, you will gain access to download any Instructable in the PDF format. You also have the ability to customize your PDF download.

Upgrade to Pro today!