MATLAB Support Package for Parallax BASIC Stamp
25 Jul 2011
22 Aug 2011)
MATLAB library for communicating with a BASIC Stamp 2 and Board of Education (BoE) kit
% Page 102
% Chapter 4, Actvity 2: SERVO CONTROL TEST PROGRAM
% Once again, this program times out instead of running forever.
% Specifically, it will run for 100 pulses; a little over two seconds. Also
% note that sendPulse is measured in units of microseconds, not in units of
% two microseconds. This sets the limits of the Parallax standard servo at
% between 500 and 2500 in theory, 700 and 2300 in practice. DO NOT GO
% BEYOND THESE RANGES; YOU MAY DAMAGE YOUR SERVO!
% MATLAB Support Package for BASIC Stamp
% Version 1.0
% Copyright 2011 The MathWorks, Inc.
bs = stamp.BasicStamp('COM4'); %Change to your BS2 serial port
for i = 1:100
bs.sendPulse(14,1500); % Change the second number to change the angle (keep within 700-2300)