Lantronix Test Program

This is a very simple program to test the serial-to-ethernet connections of a Lantronix device connected to an Arduino or Wiring board.

Technorati Tags: ,


/*
  Lantronix Test Sketch
  
  This sketch is written for an Arduino connected to a Lantronix device.
  It simply says "hello" to any byte received in the serial port.
  To test, telnet into your Lantronix device and type any key. 
  You should get a "hello" for every byte sent.
  
  Note that there is a 2-second reset at the beginning of the program.
  
  Connections:
  Lantronix TX --> Arduino RX
  Lantronix RX --> Arduino TX
  Lantronix Reset --> Arduino pin 3
  
  By Tom Igoe
  Created 11 Sept. 2006
  
*/

#define deviceResetPin 3

 void setup() {
   Serial.begin(9600);
   pinMode(deviceResetPin, OUTPUT);
   resetDevice();
 }
 
 void loop() {
    // until you get a C, keep trying to connect:
    // read the serial port:
    if (Serial.available()) {
     char inByte = Serial.read();
     Serial.println("hello");
    }
 }
 
/*
  Take the Lantronix device's reset pin low to reset it
 */
void resetDevice() {
  digitalWrite(deviceResetPin, LOW);
  delay(50);
  digitalWrite(deviceResetPin, HIGH);

  // pause to let Lantronix device boot up:
  delay(2000);
}
This entry was posted in arduino/wiring, Lantronix. Bookmark the permalink.

Comments are closed.