Freqout help??
dirtrider444
Posts: 33
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
===============================================================
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
===============================================================
Comments
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.