Parallax MX2125, Serial LCD

This is some code I modified to display the output of the Parallax Mx2125 accelerometer to the Parallax serial LCD.

const int TxPin = 6; // LCD transmit pin  
const int xPin = 2; // X output of the accelerometer
const int yPin = 3; // Y output of the accelerometer

#include <SoftwareSerial.h>
SoftwareSerial mySerial = SoftwareSerial(255, TxPin);

void setup() {
  pinMode(xPin, INPUT);
  pinMode(yPin, INPUT);
  pinMode(TxPin, OUTPUT);
  digitalWrite(TxPin, HIGH);

void loop()
  int pulseX, pulseY;  // variables to read the pulse widths:
  int accelerationX, accelerationY;  // variables to contain the resulting accelerations
  pulseX = pulseIn(xPin,HIGH);   // read pulse from x- and y-axes:
  pulseY = pulseIn(yPin,HIGH);
  accelerationX = ((pulseX / 10) - 500) * 8;
  accelerationY = ((pulseY / 10) - 500) * 8;

  mySerial.write(22); // turn on display with cusor off
  mySerial.write(17);  // turn on backlight        
  mySerial.write(13); // carriage return
  mySerial.write(12); // clear display must pause for 5ms

This sketch was put together from code taken from the Arduino Playground. I am going to modify it further to help me run a few servos that I have. I couldn’t find this anywhere so I decided to slap this together myself. It wasn’t that hard to tell you the truth. I hope this helps out someone.