Hi.
I have linked an Arduino to Matlab using UDP as:
u = udp('10.0.0.177','RemotePort',8888,'LocalPort',9060);
fopen(u);
status = fscanf(u,'%s');
fclose(u);
delete(u);
This worked fine until I wanted to call this as a function in State-flow. State-flow compiles the functions to C code and the udp function does not compile.
I tried to use compilible dsp.UDPReceiver as:
H = dsp.UDPReceiver('RemoteIPAddress','10.0.0.177','LocalIPPort',9060);
status = step(H);
release(H);
but this does not work. I found that step does not accept string, but the Arduino seems to only be able to send strings.
I also tried using the UDPReceiver block in Simulink but with very strange results. I receive numbers that dont match what is sent.
So I would like to either be able to compile the udp function or send strings via UDPReceiver, can anyone help me with that I would realy appreciate it.
/Martin