Matlab connection via the serial port, to control the robot from there (interactively)
Diff: Connect.txt
- Revision:
- 2:5de7be1a34dc
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Connect.txt Tue Nov 01 02:34:27 2016 +0000 @@ -0,0 +1,20 @@ +% 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 \ No newline at end of file