In the color recognition tutorial of admins ( which I used on my 3 in 1 bot) , I saw this code

where 108 is the reading taken

95 is the number for gray

112 is the number for white

`now using our numbers:`

grey floor = (108 - 95)/95 * 100 = 13.7% different

white line = (108 - 112)/112 * 100= 3.6% different

compare: white line < grey floor

therefore the sensor sees a white line

This pseudo code will not work on PICBASIC :

(108 - 112)/112 * 100= 3.6% different

Because 108-112 will give you a negative number ( which is unusable )

and when you divide by 112, you would get a number less than one ( also unusable)

So to fix that , I did this pseudo code

`If reading < 112 then (112-reading) *100 / 112`

If reading > 112 then (reading - 112) *100 / 112

112-reading gets rid of any possibility for negative numbers and by doing *100 first , instead of /112 first, that gets rid of numbers less than one.

Do all microcontrollers have an inability to deal with negative numbers and numbers less than 1?

Just thought I'd share,

Eric