Custom robot.
Hello im using a Parallax BOE with a basic2 stamp
Im trying to get my matlab code to tell the basic procesor what to do.
The Board is hooked up to two servo motors and the matlab program is spiting out servo pulse durations (between 400-1100)
I dont know how to get multipule outputs using the fprintf comand in matlab. so i tryed to just combine the two numbers into 1 the first 4 numbers=servo1 the last 4 numbers=servo2 and use the SKIP comand to get the numbers apart but im having trouble getting this to work. i was wondering if anybody had any sugestions on how i should go about this.
hears some of my code (full code is attached)
(the project is to design a robot turret that detects movement and fires at it)
(the last bit of basic code tells the board to open the H-Gate which aplyes power to an airsoft guns dc motor)
MATLAB
=========================
x=servo1
y=servo2
yy=x*10000+y
end
%Protecting the servos string.
·x<1150
if x>450
if y<1150
if y>450
fopen(ser)
fprintf(ser,'%d\n',[noparse][[/noparse]yy]);
fclose(ser);
===============================
BASIC
======================
' {$STAMP BS2}
' {$PBASIC 2.5}
serial CON 16
baudrate CON 84
yy VAR Word
y VAR Word
x VAR Word
counter VAR Word
x = 750
main:
SERIN serial,baudrate,[noparse][[/noparse]SKIP 4, DEC yy]
FOR counter =1 TO 50
PULSOUT 13,yy
PAUSE 20
NEXT
FOR counter =1 TO 50
PULSOUT 12,x
PAUSE 20
NEXT
other junk.....
================================
Im trying to get my matlab code to tell the basic procesor what to do.
The Board is hooked up to two servo motors and the matlab program is spiting out servo pulse durations (between 400-1100)
I dont know how to get multipule outputs using the fprintf comand in matlab. so i tryed to just combine the two numbers into 1 the first 4 numbers=servo1 the last 4 numbers=servo2 and use the SKIP comand to get the numbers apart but im having trouble getting this to work. i was wondering if anybody had any sugestions on how i should go about this.
hears some of my code (full code is attached)
(the project is to design a robot turret that detects movement and fires at it)
(the last bit of basic code tells the board to open the H-Gate which aplyes power to an airsoft guns dc motor)
MATLAB
=========================
x=servo1
y=servo2
yy=x*10000+y
end
%Protecting the servos string.
·x<1150
if x>450
if y<1150
if y>450
fopen(ser)
fprintf(ser,'%d\n',[noparse][[/noparse]yy]);
fclose(ser);
===============================
BASIC
======================
' {$STAMP BS2}
' {$PBASIC 2.5}
serial CON 16
baudrate CON 84
yy VAR Word
y VAR Word
x VAR Word
counter VAR Word
x = 750
main:
SERIN serial,baudrate,[noparse][[/noparse]SKIP 4, DEC yy]
FOR counter =1 TO 50
PULSOUT 13,yy
PAUSE 20
NEXT
FOR counter =1 TO 50
PULSOUT 12,x
PAUSE 20
NEXT
other junk.....
================================
Comments