THANKS, now the error doesn't uccurence anymore!
But I still have a problem receiving any data from my device:
I want to send a Request with 26 Bytes to the Xtender, and then I should get a Response (number of Bytes 30) in HEX like this:
Request: AA 00 01 00 00 00 65 00 00 00 0A 00 6F 71 00 01 00 B8 0B 00 00 01 00 C5 90
Response: AA 23 65 00 00 00 01 00 00 00 0E 00 96 8A 02 01 01 00 B8 0B 00 00 01 00 00 00 3B 42 44 78
How can I store all the Bytes from my Response in an array?
And the moment I'm still getting an error (invalid conversion byte to char). But I want to get the Response in hex.
The code I'm using is:
//try to receive data via hardware serial port
int led_xtender_available = 4;
int led_xtender_not_available = 13;
//Request line 26bytes, Hexadecimal
byte Request[] = {0xAA,0x00,0x01,0x00,0x00,0x00,0x65,0x00,0x00,0x00,0x0A,0x00,0x6F,0x71,0x00,0x01,0x01,0x00,0xB8,0x0B,0x00,0x00,0x01,0x00,0xC5,0x90};
//Response should have 30bytes
byte Response [30];
void setup()
{
// Open serial communications
// Set USART_Configurations: 38400bps, 1start bit, 8bit of data
// 1 parity bit, even parity, 1 stop bit
Serial.begin(38400,SERIAL_8E1);
pinMode (led_xtender_available, OUTPUT);
pinMode (led_xtender_not_available, OUTPUT);
}
void loop(){
//sending the Request to the xtender
for (int i=0; i<sizeof(Request); i++)
{
Serial.write(Request[i]);
//Serial.println(Request[i]);
//delay(500);
//proof via LED Blinking, if Xtender is available
}
if(Serial.available()>=30){
digitalWrite(led_xtender_available, HIGH);
Serial.read(Response, 30);
}else{
digitalWrite(led_xtender_not_available, HIGH);
}
}
But also If I don't try storing all bytes of the response in one Array, I'm not getting an Response... Does anybody knows why?
The encoding of the Arduino is in little endian, right?