Matlab connection via the serial port, to control the robot from there (interactively)
Connect.txt
- Committer:
- jbrouwer
- Date:
- 2016-11-01
- Revision:
- 3:4fd668c1dbf5
- Parent:
- 2:5de7be1a34dc
File content as of revision 3:4fd668c1dbf5:
% THIS IS A M FILE % SPECIFY SERIAL PORT. On windows this is COM1, COM2... % List serial ports; this=instrhwinfo('serial'); % this.AvailableSerialPorts clear all; delete(instrfindall) % this closes the previous connection. PORT = '/dev/cu.usbmodem1412'; s = serial(PORT); set(s, 'BAUDRATE', 115200); set(s, 'TERMINATOR', 'CR/LF'); fopen(s); while 1 line = fgetl(s); pulses_in = str2num(line); send_data = Controller(pulses_in,0); fprintf(s,strcat(num2str(send_data), '\r\n')); end