I am writing my question here after many attempts to solve the problem by myself and after being confused by the very fragmented information found on the web about the following subject.
First of all, I run the "Matlab R2012a", I also have (where relevant): "Arduino IO Library" and "Target for Use with Arduino" Simulink libraries.
- My aim is to acquire analog data from a Arduino board (analog input A0), plot them in real time and also write them into a file for post processing. *
In order to create an analog input, I created the simple hardware configuration in Fig.1
Voltage (5Volts) is provided to a variable potentiometer and the pin in the middle provide a voltage (analog) that is directed into the analog input of the Arduino UNO board. The connections are fine as checked with a voltmeter and also read through the Arduino Serial Monitor (0 - 1023). Finally a LED is connected to the digital (PWM) output 9.
The following model is then downloaded on the Arduino board using the "Run on Target" function in Simulink
The hardware response is as expected: as the potentiometer lever is turned the LED lights up, from zero to max light intensity.
With the Arduino running, a second model is created in Simulink and run (at the same time the potentiometer is turned) but as shown in the picture an error is given.
Can anyone suggest a way of achieving my goal ?
Thanks in advance