Matlab connection via the serial port, to control the robot from there (interactively)

Dependencies:   MODSERIAL QEI

Control.txt

Committer:
jbrouwer
Date:
2016-11-01
Revision:
3:4fd668c1dbf5
Parent:
2:5de7be1a34dc

File content as of revision 3:4fd668c1dbf5:

% THIS IS THE CONTROL.M FUNCTION

function [Motor1Out, Motor2Out] = Controller(Motor1Pulses, Motor2Pulses)
%CONTROLLER Summary of this function goes here
%   Detailed explanation goes here


SETPOINT = 8400; 
CURRENT = Motor1Pulses;

ERROR = SETPOINT - CURRENT;

k = 0.5;

Motor1Out = ERROR/8400*k;

Motor2Out=0;
end