Exchanging data between Arduino and Simulink via serial

Hi

I want to send 1 int from Simulink to Arduino and get it back in Simulink.
I send 1, but get back 48.
What am i doing wrong ?

nt incomingByte = 0; // for incoming serial data
int x;

void setup() {
Serial.begin(9600); // opens serial port, sets data rate to 9600 bps
}

void loop() {

// send data only when you receive data:
if (Serial.available() > 0) {
// read the incoming byte:
incomingByte = Serial.read();
//x = incomingByte >> 32;
x = incomingByte << 32;
Serial.print(x);

// say what you got:
//Serial.print("I received: ");
//Serial.println(incomingByte, DEC);
}
}

Simulink file is attached.

serialExample.mdl (23.8 KB)

when you use serial communication with your arduino the arduino writes ascii values to the serial port. 48 is the ascii value for 0. so your arduino program is writing the data you are expecting it to write.