I am trying to communicate to matlab with arduino via TCP/IP. I am hosting server on the arduino and making matlab as a client.
I am using the W5500 ethernet shield for my use
I am trying to send a float value to matlab but I am not even able to send an integer data to matlab
I am able to ping the arduino from cmd and I am also able to connect the matlab to arduino but everytime I try to read something I get an error message as an unsuccessful read
Can anyone help ?
So you have a server. Show your code for it. On which port is it listening?
First step would be to try to connect using telnet or putty.
telnet serveraddress serverport
Does it work? You're only interested in checking if you can connect.
Once you can connect, modify your server code so if a client connects it will send a "hello world" or something like that. You should be able to see it in telnet or putty. If not, you need to debug that part first.
Once you have a basic text working, you can test the same things in MatLab.
And after that you can start thinking about sending the float (e.g. do you want to send it as text or as 4 bytes).
I am able to send an integer on Putty
But I don't understand why I am not able to read it on matlab
t = tcpip('169.254.173.240', 30000, 'NetworkRole', 'client');
data = freadf(t,1);
and then when I write data on the command window
I am not able to read it in matlab.
OK, so you can connect from putty to arduino server.
Whst do you mean by " I am able to send an integer on Putty " ? Can you send from your Arduino server to putty and see it there?
I don't do MatLab, so can't hrlp you with that part. But your code looks a bit fishy; you do not check if your connection attemp succeeded. And a little google reveals that you might have to use 'tcpclient' instead of 'tcpip'. But as said, I have no ecpetience with MatLab.