Aha! I see that there are a few points of confusion here (I know that this is probably basic information for the experienced ethernet user, but for us beginners, it can be very difficult to understand exactly what is going on).
--> Both the handbook and cookbook sections have an "Ethernet" class, and they are different (as stated, the cookbook section has an ethernet function that sets the IP address - which doesn't make any sense!).
--> The Ethernet handbook section does have an example program of a packet "sniffer". Unfortunately, this program does not make use of the ethernet.write and ethernet.send functions to actually SEND packets (this would be nice to see, so that we can understand how packets are sent, not just how they are received).
--> Regarding the ethernet.receive function, is there a way to tie this to an interrupt, so that it will automatically process a received ethernet packet, instead of having to keep polling to see if a packet has arrived?
SO, as an example for a SEND command, if I have one mbed with a mac address if aa.aa.aa.aa.aa.aa (herein referred to as "a") and another with a mac address of bb.bb.bb.bb.bb.bb (herein referred to as "b"), and I want to send, from a to b, a single byte of 0xff, then I would write (in pseudo code):
maca[6] = [0xaa,0xaa,0xaa,0xaa,0xaa,0xaa];
macb[6] = [0xbb,0xbb,0xbb,0xbb,0xbb,0xbb];
data = 0xff;
packet[13] = [macb, maca, data];
ethernet.write(packet,13); //13 bytes --> 6 for source and destination mac addresses, 1 byte of actual data
ethernet.send;
Is this the correct way of doing things?
Greetings all! A question from those of us that are Ethernet challenged.
I have four devices (all mbed microtrollers) that are all connected to an Ethernet switch. I would like to enable simple communication between all four devices, using some kind of Ethernet protocol.
I would like to have their four addresses configured as follows:
192.168.10.1
192.168.10.2
192.168.10.3
192.168.10.4
All subnet masks: 255.255.255.0
I am pretty sure that I need to use the "Ethernet" class, but I am not sure what other classes will be needed as well.
Question: If, for example, I would like mbed controller "192.168.10.2" to send a simple message to controller "192.168.10.4", how would I accomplish this?
Thanks for any help you can provide! -RT