

If InvertBits has been set though, the result will be 0x08. If the sensor's lights show: ON, ON, ON, ON, OFF, ON, ON, ON, this function will return 0xF7 matching the bit positions on the silkscreen. Get a reading from the array as a single 8 bit word where each bit represents an IR sensor. Serial.println("sx1509 IC communication FAILED!") Serial.println("sx1509 IC communication OK") Uint8_t returnStatus = mySensorBar.begin() Place it in the setup() section to run once. begin() has been run, the sensor bar is ready to start reading data. In the example ReadBarOnly the sketch is held if the sensor did not respond.Īfter. Returns 1 if it was able to communicate with the sensor bar or 0 if it had troubles. Returns success message (unsigned 8 bit). Use begin to start the sensor bar's I2C expander. Pass the device address in HEX ( unsigned 8 bit ). The basic library has the following parts Object constructionĮach instance of the SensorBar library needs to be constructed in the global scope for all to access. I 2C address selection - Set the jumpers in accordance with the table for a desired address.The IR transducers - These emit and detect IR radiation.Mounting holes - The inner two holes fit the Shadow chassis.I2C pull option jumper - Defaulted to 3.3V pull-up.Digital interface - Described in the Assembly section.Note: these are not inverted by the library's set/clearInvertBits() functions. Robot vision indicators - See what the IR sensors are picking up.Polarity marking - Shows getPosition() polarity.IR brightness control and indicator - The IR PWR led shows the strength of the IR LEDs.Counting and Converting in Binary - The sensors correspond to bit positions in a byte.Working through this experiment revels why eight sensors is better. Line following experiment - One of the experiments for the RedBot is line following with only three sensors.RedBot Experiment Guide - Using the RedBot with red or black chassis? Work through some experiments first in order to get going.I 2C Communication - The array is controlled over an I 2C interface.

If you want to learn more about I 2C or are using the RedBot kits, check out this additional material. The array acts as a stand alone I 2C device pretty well.


#Line follower arduino while loop software
Switch visual indicators on and off with software.Adjust IR brightness on the fly with a knob.8 sensor eyes (QRE1113, like in our line sensor breakout).
