Shop OBEX P1 Docs P2 Docs Learn Events
Freqout help?? — Parallax Forums

Freqout help??

dirtrider444dirtrider444 Posts: 33
edited 2011-10-13 22:05 in BASIC Stamp
I am learning the commands and meanings for the "Ping" programming for BS2 Boe-Bot. I dont understand what the " (freqSelect + 3), DEC5 irFrequency " mean?? Why is there a 3 involved and where did that number come from?? Why is DEC5 involved?? Where did that 5 come from?? I understand "DEC" is a form of "DEBUG" and it is when a decimal value is to be stated but why there and how did the 5 "comeabout?" Below is the program...THANKS!!

TAYLOR

====================================================

DO

distance = 0

FOR freqSelect = 0 to 4

LOOKUP freqSelect, [37500, 38250, 39500, 40500, 41500], irFrequency
FREQOUT 8, 1, irFrequency
irDetect = IN9
distance = distance + irDetect

DEBUG CRSRXY, 4, (freqSelect + 3), DEC5 irFrequency
DEBUG CRSRXY, 11, freqSelect + 3

IF (irDetect = 0) THEN DEBUG "Yes" ELSE DEBUG "No "

PAUSE 100

NEXT

DEBUG CR,
"

"
"Zone ", DEC1 distance
LOOP

===============================================================


:innocent:

Comments

  • dirtrider444dirtrider444 Posts: 33
    edited 2011-10-13 21:50
    The picture in my book and the schematic show nothing being connected to pin 5. so my understanding is that it would mean that " DEC5 " is referring to a storage value at pin 5???
  • Mike GreenMike Green Posts: 23,101
    edited 2011-10-13 22:05
    No, no, no, no!

    There are prefixes called "formatters" that are used in the SERIN and SEROUT statements as well as their cousins, the DEBUGIN and DEBUG statements. Read the relevant portions of the BASIC Stamp Syntax and Reference Manual for those statements as well as the appendix on these "formatters". Some formatters include BIN, DEC, and HEX as well as variants with a digit from 1-5 on the end, like DEC5.
Sign In or Register to comment.