Datasheet
Page 138ยท Applied Robotics with the SumoBot
WRITE QtiThresh, Word multi ' <--- New threshold to EEPROM
RETURN
' -----[ Subroutine - Read_Line_Sensors ]-------------------------------------
Read_Line_Sensors:
HIGH qtiPwrLeft ' Turn on QTIs
HIGH qtiPwrRight
HIGH qtiSigLeft ' Push signal voltages to 5 V
HIGH qtiSigRight
PAUSE 1 ' Wait 1 ms for capacitors
READ QtiThresh, Word temp ' <-- Add get threshold time
INPUT qtiSigLeft ' Start the decays
INPUT qtiSigRight
' PULSOUT DummyPin, qtiThreshold ' Wait for threshold time
PULSOUT DummyPin, temp ' <--- New wait threshold time
qtiLF = ~qtiSigLeft ' Snapshot of QTI signal states
qtiRF = ~qtiSigRight
LOW qtiPwrLeft ' Turn off QTIS
LOW qtiPwrRight
RETURN
' -----[ Subroutine - Read_Object_Detectors ]---------------------------------
Read_Object_Detectors:
FREQOUT IrLedRS, 1, IrFreq ' Right side IR LED headlight
irRS = ~IrSenseRS ' Save right side IR receiver
FREQOUT IrLedRF, 1, IrFreq ' Repeat for right-front
irRF = ~IrSenseRF
FREQOUT IrLedLF, 1, IrFreq ' Repeat for left-front
irLF = ~IrSenseLF
FREQOUT IrLedLS, 1, IrFreq ' Repeat for left side
irLS = ~IrSenseLS
RETURN
' -----[ Subroutine - Read_Pushbutton ]---------------------------------------
Read_Pushbutton: