This code reads the analog data being xmitted by an XBEE endpoint. That works well, I am having an issue with the sparkfun serial display. The code below outputs 6 characters I am expecting (or would like only 4) 0 to 1023.
Any helpful ideas. I'll use the XBEE lib after I get this working. ![]()
Hardware xbee 1.0 end point and xbee 1.0 shield on an UNO
//xbee router
#include <SoftwareSerial.h>
;SoftwareSerial mySerial(10, 11); // RX, TX
// the setup routine runs once when you press reset:
byte discardbyte;
int led = 13;
void setup() {
 // initialize serial communication at 9600 bits per second:
 pinMode(led, OUTPUT);
 Serial.begin(9600);
 mySerial.begin(9600);
 mySerial.write(254);
 mySerial.write(01);
 mySerial.write(254);
 mySerial.write(129);
 mySerial.print("SEN1 SEN2 SEN3");
}
void loop() {
 if (Serial.available()>=23){
 Â
  if (Serial.read()==0x7E){
 Â
    for (int i=1; i<15; i++){
     discardbyte = Serial.read();
Â
    }
  }
   int analogLSB = Serial.read();
   int analogMSB = Serial.read();
int analogReading =Â analogLSB + (analogMSB * 256);
  constrain(analogReading, 0, 1023);
  Â
   Serial.println(analogReading);
mySerial.write(254);
mySerial.write(193);
mySerial.print(analogReading, DEC);
//mySerial.write(254);
//mySerial.write(197);
//mySerial.write(" ");
//analogReading=0;
  }
}