Datasheet

Chapter 3: EEPROM Tricks and Program Tips ยท Page 117
Your Turn - Active High vs. Active Low
At present, the alert for the SumoBot encountering the white tawara line is when either
qtiStateLeft or qtiStateRight store 0. You can use the invert bits operator (~) to
change this so that the
qtiState variables store 1 when they see they see white.
โˆš Use the invert bits operator, the tilde ~, to invert the states of the
qtiSig PIN
names before storing them in the
qtiState variables. In other words, change:
qtiStateLeft = qtiSigLeft
qtiStateRight = qtiSigRight
to
qtiStateLeft = ~ qtiSigLeft
qtiStateRight = ~ qtiSigRight
โˆš Update the IF...THEN statements that are checking for qtiState variables
being equal to zero. They need to check for the
qtiState variables being equal
to 1.
โˆš Save, run and test your modified program.
ACTIVITY #5: ADDING AND TESTING SENSORS AND INDICATORS
Figure 3-16 shows the SumoBot with IR object detectors added to the breadboard that
will detect opponents on the side. The next activity adds and tests these sensors.