Originally posted by Bit's-n-Bytes
View Post
Start:
SYMBOL D1Sense = W3 '########## Reserves buffer for D1 Value
SYMBOL D5Sense = W4 '########## Reserves buffer for D5 Value
SYMBOL D9Sense = W5 '########## Reserves buffer for D1 Value
SYMBOL D10Sense = W2 '########## Reserves buffer for D5 Value
SYMBOL TotalCompare = W1 '########## Reserves buffer D1 + D5
Main:
readadc10 0, D9Sense '########## Reads voltage at pin 17 an assign value to D9Sense
readadc10 1, D10Sense '########## Reads voltage at pin 18 an assign value to D10Sense
readadc10 6, D1Sense '########## Reads voltage at pin 15 an assign value to D1Sense
readadc10 7, D5Sense '########## Reads voltage at pin 16 an assign value to D5Sense
;let D9Sense = 8 '########## Used to debug
;let D10Sense = 12 '########## Used to debug
;let D1Sense = 1 '########## Used to debug
;let D5Sense = 10 '########## Used to debug
let TotalCompare = D1Sense + D5Sense '########## Adds value of D1 and D5
if D9Sense < TotalCompare then SwitchGroup2
if D9Sense > TotalCompare then SwitchGroup1
if D10Sense < TotalCompare then SwitchGroup1
if D10Sense > TotalCompare then SwitchGroup2
goto main
' ########## Oscillates S1, S3, & S6
SwitchGroup1:
pulsout 7,10000 ' send pulses out of pin 6
pause 20 ' pause 20 ms
pulsout 0,5000 ' send pulses out of pin 13
pause 20 ' pause 20 ms
goto Main
' ########## Oscillates S2, S4, & S5*
SwitchGroup2:
pulsout 0,10000 ' send pulses out of pin 13
pause 20 ' pause 20 ms
pulsout 7,5000 ' send pulses out of pin 6
pause 20 ' pause 20 ms
goto Main
Thanks
Jeff
Comment