Go Down

Topic: Simulink and Arduino Mega (Read 148 times) previous topic - next topic

Fakiko

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):

Code: [Select]

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?

spycatcher2k

Quote
I tried with "Serial receive" and "Packet output", but I always get a 0. What should I do?
Quote
I'm trying to connect arduino mega to simulink
The Mega works fine, this is a simulink problem (Hint - your in the wrong forum)
Mrs Drew
-=-
http://www.uk-pcb.co.uk - UK PCB Fab Company
I will design & code for you, but I will also charge you (PM me)
If you don't like my answers, realize : I'm not being cheeky, I'm Just trying to prompt you to use your own brain/google etc.

sterretje

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.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Go Up