Simulink and Arduino Mega

Hey guys.

I'm trying to connect arduino mega to simulink, in order to transmit data from Arduino to Simulink. This is the code I'm using (very simple):

int ref1;

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

void loop() {
  ref1=20;
  Serial.print(ref1);
}

As you can see, I use serial port to transmit data. I want to show the data ref1 in Simulink with a Display. The problem is I don't know which block should I use to receive the data from Arduino, I tried with "Serial receive" and "Packet output", but I always get a 0. What should I do?

(deleted)

I suggest that you use Serial Monitor for the debugging (if needed) of the Arduino side of things; once you're confident that that works correctly, start working on the simulink side of things.

Be aware that when opening the serial port on the PC, your Arduino will be reset and you will have to wait a while before the PC will see data coming from the Arduino.

Further, as Mrs. Drew pointed out, you have a far better chance at a forum dedicated to simulink; there are probably not that many simulink users here.