matlab and basic stamp 2 interface problems..
wawloh
Posts: 2
hi folks,
i'm trying to interface matlab to my BS2 and if it works, will blink
an LED
bs2 code :
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}
status_pin VAR Word
main:
SERIN 16,84,[noparse][[/noparse]DEC status_pin]
IF status_pin = 0 THEN LOW 8
IF status_pin = 1 THEN repeat
GOTO main
repeat:
PAUSE 500
HIGH 8
PAUSE 500
LOW 8
GOTO repeat
%matlab code :
status_pin = 1;
s=serial('com1')
set(s,'baudrate',9600)
set(s,'terminator','CR')
fopen(s);
fprintf(s,'%s\d',[noparse][[/noparse]status_pin]); %if data is sent, i should see the LED
blinking once this line is executed am i rite??
fclose(s)
any ANY help is very much appreciated..really frustrated with such a
simple code but nothing seems to work?!
i'm trying to interface matlab to my BS2 and if it works, will blink
an LED
bs2 code :
' {$STAMP BS2}
' {$PBASIC 2.5}
' {$PORT COM1}
status_pin VAR Word
main:
SERIN 16,84,[noparse][[/noparse]DEC status_pin]
IF status_pin = 0 THEN LOW 8
IF status_pin = 1 THEN repeat
GOTO main
repeat:
PAUSE 500
HIGH 8
PAUSE 500
LOW 8
GOTO repeat
%matlab code :
status_pin = 1;
s=serial('com1')
set(s,'baudrate',9600)
set(s,'terminator','CR')
fopen(s);
fprintf(s,'%s\d',[noparse][[/noparse]status_pin]); %if data is sent, i should see the LED
blinking once this line is executed am i rite??
fclose(s)
any ANY help is very much appreciated..really frustrated with such a
simple code but nothing seems to work?!
Comments
Hope that helps put you on track
Jeff T.
How do you know when it's inverted and not true? In this example, how did you know?
·