I am new here and to Arduino and have some questions about setting up Ethernet and UDP.

I want to send data from an analog pin down an Ethernet cable to my computer. I will then use this data in Max/MSP using the "UDP receive" object.

I am using the official Arduino Ethernet shield (W5100). Am I correct in assuming that I don't need to be connected to the internet to set up network in this way?

I have been looking through example code and have got so far but all of the projects I have found so far are about publishing data to web pages. Al of this extra code for the web page stuff is confusing me. I know it's missing a lot but I have this so far

// read the packet into packetBufffer and get the senders IP addr and port number Udp.readPacket(packetBuffer,UDP_TX_PACKET_MAX_SIZE, remoteIp, remotePort); Serial.println("Contents:"); Serial.println(packetBuffer);

The Arduino side of the current UDPSendReceiveString example does not have a line that says "UDP Udp;". I think it is a singleton: an object of which there is only one instance. Try starting with the example again.

OK gettng there! So this is what I have now. The data from the photocell is appearing in the serial monitor. Do you know how I get that same photocell data down my Ethernet cable? I'm sure I'm just missing one or two lines of code here...

// read the packet into packetBufffer and get the senders IP addr and port number Udp.readPacket(packetBuffer,UDP_TX_PACKET_MAX_SIZE, remoteIp, remotePort); Serial.println("Contents:"); Serial.println(packetBuffer);

According to the comments in your code, it appears you are setting the Arduino's IP address to the same as your computer's. That will create problems on your network. Your Arduino's IP address should be one that is not being used by another device on your subnet. Same goes for the MAC but it probably is unique enough already.

I think I need to initialise remotePort and remoteIp with the ip address and port number on my computer, I'm confused how to do this. Also do I have the "photocell reading" in the right place to send to the computer?

I'm even more confused now. If I run the ifconfig command in terminal it tells me my ip address is one thing and if I look in system pref>network have another 2 different ip addresses: One for my air port and another for my built in ethernet as well as a subnet mask

I want to send data down the Ethernet cable not wireless, so do I need to use the "self assigned" ip address and subnet mask that is displayed in my system pref>network> window?

Your Airport IP is most likely your gateway, DHCP & DNS IP. In your code, destIp should be your computer's builtin ethernet IP, myIp should be an IP address that is not in use by any other device on your network. I have no idea what your network looks like so I can't say what IP will be unused. Try using the ping command in terminal to see if you get any replies before using a random IP for myIp.

On most home networks, your subnet is 255.255.255.0. That means all the devices on your network will share the same first 3 octets, only the last octet in the IP address will change. For example, if the router/gateway IP address is 192.168.0.1, then your computer IP should be 192.168.0.x, and your Arduino's IP should be 192.168.0.x (different than the computer, where 'x' means a number from 2 - 254, 255 is reserved for broadcast msgs). I can't guarantee that your network is like I just described. Run ifconfig, you probably have a connection named eth0, note what it's inet addr and mask are. That is your computer's IP address and your network's subnet mask. Usually, all devices on the same network have the same subnet mask.

If the IP addresses in your code are the actually addresses you are trying to use, you will have problems. destIp looks like a randomly selected IP due to a lack of a DHCP server, usually also with a 255.255.0.0 subnet. With those IPs, your arduino and computer will not be able to communicate.