Checksum calculation for XBee/Writing on serial code won't compile

modified your code a bit where I thought the error could be could be coming from.

let us know how it goes! :slight_smile:

#define sensorPin A0
int sensorValue=0;
byte checkSum = 0;
byte valueFrame=0;

void setup() {
  Serial.begin(9600);
}

void loop() {
int temp;
  sensorValue=analogRead(sensorPin);
  valueFrame=map(sensorValue, 0, 1023, 0, 255); //bear in mind that you will be loosing resolution! you're going from 10 bit (ADC resolution) to 8 bits (byte type)! 
  temp = 0xFF - (0x01+0x00+0xFF+0xFF+0x00+0x01+valueFrame);
  checkSum = (byte) temp;
  byte frame[] = {0x7E, 0x00, 0x07, 0x01, 0x00, 0xFF, 0xFF, 0x00, 0x01, valueFrame, checkSum};
  Serial.write(frame, sizeof(frame));
}

hope that helps