Reading from Serial

YES!

Serial communication is a go!

Now on to the actual problem. I modified my code with elements from that test sketch so that i can be sure that data is coming through and when i run the carserver client, my light flickers constantly, almost in time with the light on my router. I set this up to println back to the txpin when i have debug turned on and then i used cat < /dev/tts/1 to listen to what was coming across. So basically, the way i see it is that the router is pumping something out, the arduino looks at it and turns around and sends it right back. That data i can see raw in my terminal window... here's the thing. It's just putting out a 0 and a carrige return.... now at some point i had vb6 application that controls the car working to an extent and it put out two 0's and any time i hit a key, it would put out a different number. I cant figure out what has changed. Can you run through my new code and see if i have it set up and reading incorrectly?

 // include the SoftwareSerial library so you can use its functions:
#include <NewSoftSerial.h>
#include <ctype.h>

#define DEBUG 0

#define txPin 9
#define rxPin 8
#define LEDpin 13

NewSoftSerial mySerial(8,9);
int inByte;         // incoming serial byte

#define bit9600Delay 84
#define halfBit9600Delay 42
#define bit4800Delay 188
#define halfBit4800Delay 94

int serialChar; // stores character of serial Input as integer
 
unsigned long decay; // counter from last command
unsigned long decaylimit=100000; // 100,000 is about 5 seconds

 
void setup() {
    // define pin modes for tx, rx, led pins:

  pinMode(LEDpin, OUTPUT);
  // set the data rate for the SoftwareSerial port
  Serial.begin(9600);
  mySerial.begin(115200);
  Serial.println("Hello"); // For debugging purposes
  
 
  //left/right motors
  pinMode(4, OUTPUT);
  pinMode(5, OUTPUT);
  pinMode(6, OUTPUT);
  pinMode(7, OUTPUT);
  //end debugging
}
 
int SWread()
{
  byte val = 0;
  while (digitalRead(rxPin));
  //wait for start bit
  if (digitalRead(rxPin) == LOW) {
    delayMicroseconds(halfBit9600Delay);
    for (int offset = 0; offset < 8; offset++) {
     delayMicroseconds(bit9600Delay);
     val |= digitalRead(rxPin) << offset;
    }
    //wait for stop bit + extra
    delayMicroseconds(bit9600Delay);
    delayMicroseconds(bit9600Delay);
    return val;
  } 
}
void loop() {
  //check for serial communications
 {

  if (mySerial.available()) {
      serialChar = mySerial.read();
      mySerial.println((char)inByte); 
                digitalWrite (LEDpin, HIGH);
		delay (100);
		digitalWrite (LEDpin, LOW);
		delay (100);
    
    // decay counts the age of the last command
    // at the limit (100,000 = ~5 seconds, all signals are shut off
    if (decay > decaylimit) {
      digitalWrite(4, LOW); 
      digitalWrite(5, LOW); 
      digitalWrite(6, LOW); 
      digitalWrite(7, LOW);
      // stop counting at limit, shut off all pins
    }
    else {
      decay++;
    }
   
   {
 
 #if DEBUG     // echo for debugging only:
      Serial.println(serialChar);
 #endif
        // serialChar contains the ASCII code of the *first* character sent over serial when defined as int
        switch (serialChar) {
 
         // logical signals w s a d style     
         case '119': 
           digitalWrite(4, LOW);  
           digitalWrite(7, LOW);
           digitalWrite(5, HIGH);
           digitalWrite(6, HIGH);            
            decay=0;            
            break;
         case '115': 
            digitalWrite(5, LOW); 
            digitalWrite(6, LOW); 
            digitalWrite(4, HIGH);
            digitalWrite(7, HIGH);            
            decay=0;            
            break;
         case '97':  
            digitalWrite(5, HIGH); 
            digitalWrite(6, LOW); 
            digitalWrite(4, LOW);
            digitalWrite(7, LOW);            
            decay=0;            
            break;
         case '100': 
            digitalWrite(4, LOW); 
            digitalWrite(6, HIGH); 
            digitalWrite(5, LOW);
            digitalWrite(7, LOW);            
            decay=0;            
            break;            
         case '113': 
            digitalWrite(4, LOW); 
            digitalWrite(5, LOW); 
            digitalWrite(6, LOW); 
            digitalWrite(7, LOW);
            decay = decaylimit;            

        }
      }
    }
  }
 }