Ethernet Shield Examples
For XPort type modules only!

This documentation is for the XPort type modules, not WIZnet! See the Ethernet Shield library for WIZnet documentation.

PLEASE NOTE! We do not manufacture, sell or support Lantronix or WIZnet products! These examples are for your information and entertainment, we do not guarantee they work - many have had changes to the IDE and underlying libraries - and they are offered AS IS

XPort library

I've written a library to make talking to the XPort devices -really- easy!

Here's the interface:

Simple data fetching sketches

Here are some example sketches using the NewSoftSerial library and AF_XPort library to talk to the XPort. You'll notice that most use the same chunk of XPort interfacing code and then just send data and look for responses. These examples should get you going in the right direction...

These examples all use a local (Ardino USB) baudrate of 57600 and an xport baudrate of 57600. They probably wont work without wiring up the xport RESET, DTR, CTS pins (RTS is indicated but isnt actually used), the xport Channel 1 flow control should be "02"

*** Channel 1
Baudrate 57600, I/F Mode 4C, Flow 02
Port 10001
Connect Mode : D4
Send '+++' in Modem Mode enabled
Show IP addr after 'RING' enabled
Auto increment source port disabled
Remote IP Adr: --- none ---, Port 00000
Disconn Mode : 00
Flush Mode : 77

Simple webserver examples

Here is an example webserver with javascript. The XPort is open on port 80 (standard http port) and will present a webpage:

On the page is a color-picking javascript object. The box with #xxxxxx in it indicates the current color of the LED (red, green, blue hex) and an approximate color representation. You can change the color by clicking on the "..." button

which will pop up the color picking table. Select the color desired...

And then click Submit to update the LED on the arduino!

On the hardware side, I used a single RGB (tri-color) LED, common-anode type with the three LEDs connected to pins 9, 10 and 11. The XPort's RX and TX are connected to pins 2 and 3. You can watch debug output on the Serial monitor (ie each time a connection is made)

The XPort is configured thusly:

*** Channel 1
Baudrate 57600, I/F Mode 4C, Flow 00
Port 00080
Connect Mode : D4
Send '+++' in Modem Mode enabled
Show IP addr after 'RING' enabled
Auto increment source port disabled
Remote IP Adr: --- none ---, Port 00000
Disconn Mode : 80 Disconn Time: 00:03
Flush Mode : 77

Note the different port and Disconn Time settings. If you're using a Direct+ or a normal XPort you can avoid using the disconnect timeout to drop connections but I couldnt get it working on the Direct. This works just fine tho.

Here is the arduino sketch!

Memory used is ~12K flash (a lot of that is the javascript code for the color picker) and maybe 512 bytes of RAM.

May 17, 2011 20:07