[Robotgroup] PBasic question
Mohammad El-Abid
elabidster at gmail.com
Wed Dec 6 15:23:37 PST 2006
Okay I got the boe-bot and they have a experiment where you find out how
fast it's going and how to calculate how long it takes for it to go x
distance with
Distance divided by speed. So I thought I would one-up that! So I wrote a
code that you just enter in the inches per sec. your machine goes then how
far you want it to go (in ins), but I'm a programmer and know very well that
there are Floats, Fixnums, Bignums, and decs. So in PBasic what is the
decimal code?
Here's my code for those who are interested:
' {$STAMP BS2}
' {$PBASIC 2.5}
' This is for distance measurement
speed VAR Byte ' inches per sec.
distance VAR Word ' how many inches should it go?
division VAR Word
' math
speed = 9
distance = 12
division = distance/speed
DEBUG ? speed
DEBUG ? distance
DEBUG ? division
DEBUG 41*division, CR
'41 runs = 1 sec.
FOR counter = 1 TO 41*division
PULSOUT 13, 850
PULSOUT 12, 650
PAUSE 20
NEXT
END
More information about the Robotgroup
mailing list