MATLAB Support Package for Parallax BASIC Stamp
25 Jul 2011
(Updated 22 Aug 2011)
MATLAB library for communicating with a BASIC Stamp 2 and Board of Education (BoE) kit
% Page 37
% Chapter 2, Activity 2: ON/OFF CONTROL WITH THE BASIC STAMP
% Note that a for loop is used instead of a while loop in this example.
% This is because it's not possible to stop the program by turning off the
% Stamp because MATLAB is the one running the program. We could also try
% having a loop that is terminated by a button press; that would allow for
% an infinite loop that can be stopped.
% Run this script by clicking the "Run" button in the toolbar (it looks
% like a green "start" triangle).
% MATLAB Support Package for BASIC Stamp
% Version 1.0
% Copyright 2011 The MathWorks, Inc.
bs = stamp.BasicStamp('COM4'); %change to your BS2 serial port.
disp('The LED connected to P14 is blinking!');
for i = 1:10
pause(.5); % pause argument is measured in ms