Datasheet

Page 92ยท Applied Robotics with the SumoBot
The next example program is another modified version of
TestIrFrontObjectDetectors.bs2. The
IrFreq constant in the FREQOUT command's
Freq1 argument is replaced with a Word variable named frequency. This variable is
swept from 36000 to 42000 in steps of 500 by a
FOR...NEXT loop. It's a quick and easy
way to perform a frequency sweep with the IR LEDs and capture the IR receivers'
frequency responses.
' -----[ Main Routine ]-------------------------------------------------------
FOR frequency = 36000 TO 42000 STEP 500
FREQOUT IrLedLF, 1, frequency ' Left IRLED shines IR light
irLF = ~IrSenseLF ' Save IR receiver output
FREQOUT IrLedRF, 1, frequency ' Repeat for right IRLED/receiver
irRF = ~IrSenseRF
DEBUG CR, DEC frequency, CRSRX, 11 ' Display yes/no for detection
IF irLF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
DEBUG CRSRX, 19
IF irRF = 1 THEN DEBUG "yes" ELSE DEBUG "no"
PAUSE 50 ' Delay for slower PCs
NEXT
Frequency Sweep and Frequency Response
Transmitting a sequence of frequencies is commonly referred to as "frequency sweep". The
response of a sensor or circuit to a frequency sweep is called its "frequency response".
Example Program: TestFrequencyResponse.bs2
This program should be used with a white wall at various distances from the front of the
SumoBot to get an idea of which frequencies make it more nearsighted and which
frequencies make it more farsighted. These tests should then be repeated with a
SumoBot in the ring. The goal is to determine a frequency for each detector that is most
likely to detect the SumoBot opponent and least likely to detect a nearby onlooker.
โˆš Enter, save, and run TestFrequencyResponse.bs2, and leave the SumoBot
connected to the serial cable.
โˆš Face the SumoBot at a white wall 1 m away.
โˆš Press and release the Reset button.