I switched to ADCIN and everything works now as far as the A/D parts, but if anyone wants to school me in getting the direct way right, feel free... I hated to go ahead and post a reply to myself and drive my post to the top, but I didn't want anyone wasting their time on me either! BUT i still can't get the "fuzzy logic" part down.. I've done it with a single variable before, say, limiting a temperature alarm to sounding when a temperature goes above or below a certain value by a few points... I've tried the following code from John Iovine's book with no luck as well (using ADCIN and all variables are declared.. it just seems the code its self won't work)
diff = 10
IF LFT_TLS = RHT_TLS THEN Start:
IF LFT_TLS > RHT_TLS THEN Greater:
IF LFT_TLS < RHT_TLS THEN Lesser:
Greater:
b2 = LFT_TLS - RHT_TLS
IF b2 > diff THEN
GOSUB FWDLFT_TRN:
GOTO Start:
ELSE
GOTO Start:
ENDIF
Lesser:
b2 = RHT_TLS - LFT_TLS
IF b2 > diff THEN
GOSUB FWDRHT_TRN:
GOTO Start:
ELSE
GOTO Start:
ENDIF
which should dampen out the response a little, like if they are with in 10 points of each other it counts them as being equal and the bot should go straight. it just seems to make my light sensors clamp to either the high end of thier range or the low end, and adjusting
"diff" doesnt seems to make a difference.. i've tried switching < for > and everything in between... plus his code seems to use up a lot of code space for no more than what is there? anyone have anything better? ( i know i could lose one if then if i move lesser: up, im just printing as close to his code as i can for the sake of it)
again thanks ahead of time for any and all help!
Bookmarks