'reading a bend sensor with RCTIME rcPin PIN 4 'input/output pin for RCTIME rValue VAR WORD 'raw reading from RCTIME rValuePrev VAR WORD 'previous value degrees VAR BYTE top: HIGH rcPin 'set pin high PAUSE 1 'pause for 1ms RCTIME rcPin,1,rValue 'read the pin 'DEBUG DEC rValue,CR IF rValue <> rValuePrev THEN 'check if value has changed rValuePrev = rValue 'record new value IF rValue > 170 THEN 'approximate value when flat degrees = (rValue-730)/16 'crude conversion to degrees DEBUG "readout: ",DEC rValue," degrees: ", DEC degrees, CR ENDIF ENDIF PAUSE 50 GOTO top 'return to beginning ' CIRCUIT: ' ' +5v --- .01uF --- 220ohm -- INPUT_PIN ' | ' BEND_SENSOR ' | ' GROUND ' '