Condition Evaluation
I'm sure this is a noob question but I can't seem to figure it out.
Why does this UNTIL evaluate as TRUE on the 1st iteration:
This is the DEBUG output:
lastPhotoTime = 220
photoTime = 210
sub = -10
PhotoDelta = 100
photo reached delta
Why does this UNTIL evaluate as TRUE on the 1st iteration:
PhotoDelta CON 100 ' Difference required between light readings
HIGH 7 ' Turn on LED servo = 0 HIGH 6 ' Charge cap PAUSE 100 RCTIME 6, 1, lastPhotoTime ' Read discharge time DEBUG "lastPhotoTime = ", DEC lastPhotoTime, CR photoTime = lastPhotoTime ' Init var DO lastPhotoTime = photoTime ' Keep last reading servoPos = Servo0Up SEROUT PSCSerial, PSCBaud+$8000,[noparse][[/noparse]"!SC", servo, Ramp, servoPos.LOWBYTE, servoPos.HIGHBYTE, CR] PAUSE ValveOpenTime servoPos = Servo0Dw SEROUT PSCSerial, PSCBaud+$8000,[noparse][[/noparse]"!SC", servo, Ramp, servoPos.LOWBYTE, servoPos.HIGHBYTE, CR] PAUSE PixelPause HIGH 6 ' Charge cap PAUSE 100 RCTIME 6, 1, photoTime ' Read discharge time DEBUG "photoTime = ", DEC photoTime, CR DEBUG "sub = ", SDEC (photoTime - lastPhotoTime), CR DEBUG "PhotoDelta = ", DEC PhotoDelta, CR [color=red][b]LOOP UNTIL photoTime - lastPhotoTime > PhotoDelta[/b][/color] LOW 7 ' Turn off LED
DEBUG "photo reached delta", CR STOP
This is the DEBUG output:
lastPhotoTime = 220
photoTime = 210
sub = -10
PhotoDelta = 100
photo reached delta
Comments
Post Edited (TWRackers) : 2/27/2009 4:03:05 PM GMT