Hi there,
I'm using appdesigner to communicate with an arduino which is connected to a small robot arm. The robot is doing a simple pick&place for me.
For communication with the robot I send simple strings like this:
The first six numbers refer to the degrees of the robot joints. The last two are addition info, which is unimportant for now.
As there can be several hours between the robot actions, I would like Matlab to move the robot and then disconnect from the serialport, and reconnect when it's time.
This is currently some of the code that I'm using:
app.s = serialport('COM5',9600);
Position2 = '<80,165,0,0,0,55,1,50>';
write(app.s,Position2,'string');
app.s.delete;
app.s = serialport('COM5',9600);
Position3 = '<120,165,0,0,0,55,1,50>';
write(app.s,Position2,'string');
When this code is executed, no error pops up. The serialport is succesfully opend, but the Robot doesn't move.
Normally it takes the robot a couple seconds (3-5s) to 'wake-up'. If I create the serialport object manually via the console and I wait a couple seconds and then execute the write command via console, it works fine. It just won't work when using the script. Also adding an additional pause after reconnection won't work.
Is there anyone out there who has some usefull insights into the matter?
Thank's a lot!