Here is the section of code that does the listening. I did not post the entire code because it’s kinda long with all the constants for the speakjet.
The code:
[code]Main:
DO
sglDif = dif
FOR oddSign = 0 TO 1
GOSUB Read_0832
mVolts(oddSign) = adc(oddSign) */ Raw2mV
DEBUG CRSRXY, 7, (9 + oddSign),
DEC3 adc(oddSign), TAB,
DEC mVolts(oddSign) DIG 3, ".", DEC3 mVolts(oddSign)
LeftEar = adc(0) 'Get value from Channel 0
RightEar = adc(1) 'Get value from channel 1
DEBUG HOME, CR, DEC3 RightEar, " <---RT MIC" 'Print value of CH1
DEBUG CR, DEC3 LeftEar, " <---LT MIC" 'Print value of CH2
IF RightEar > 13 THEN 'Threshold. If > than, then do something.
DEBUG HOME, "RT Ear" 'right side
RightEar = 0
PAUSE 50
SEROUT TX\RDY, $0054, [PA1,RR,RR,OHIH,TU,PA6,SE,OHIH,DE,PA2]
ELSEIF (LeftEar) > 20 THEN 'Else this is greater than set threshold, do something.
DEBUG HOME, "LT Ear" 'LEFT SIDE
PAUSE 50
LeftEar = 0
SEROUT TX\RDY, $0054,[PA1,LE,EY,FF,FF,TU,PA6,SE,OHIH,DE,PA2]
ELSE
DEBUG HOME, " " 'Else Clear labels.
ENDIF
NEXT
LOOP[/code]