{"title":"Trace Unit (For Lidar Bot/Bala)","handle":"trace-unit-for-lidar-bot-bala","url":"/products/trace-unit-for-lidar-bot-bala","description":"   Description TRACE&nbsp;is mainly consist of 4 sets of IR, 1x infrared emitting and 1x infrared receiver for each set. The infrared LEDs should be placed towards and close to the ground where having black tracing lines and white background (or vice versa) layouts. The IR transmitter keep emitting, at the mean time infrared ray would be absorbed by different color of objects. Black can absorb more ray than other color, so the infrared receiver (infrared sensitive phototransistor) would receive less which makes the resistance value of the phototransistor would vary with different object color. Then we assign an AD convertor tp capture the data. This Unit communicates with the M5Core via GROVE PORTA I2C(0x5A).   Product Features  operation range: The reflecting surface is less than 11mm from the photoelectric surface Program Platform: Arduino, UIFlow(Blockly,Python) Two Lego-compatible holes   Kit includes  1x TRACE Unit 1x Grove Cable   Application  Self-tracing robot  Documents  TRACE Firmeare  Learn Example  1. Arduino IDE The code below is incomplete. To get complete code, please click&nbsp;here。 #include &lt;M5Stack.h&gt; #include \"Wire.h\"  #define TRACE_ADDR 0x5a  // declaration #define VALUE_SPLIT uint8_t value; int SensorArray[4] = {0};  // initialization m5.begin(); Serial.begin(115200); Wire.begin();   // read data Wire.beginTransmission(TRACE_ADDR); Wire.write(0x00); Wire.endTransmission(); Wire.requestFrom(TRACE_ADDR,1); while(Wire.available()){     value = Wire.read(); } SensorArray[3] = (value&amp;0x08)&gt;&gt;3; SensorArray[2] = (value&amp;0x04)&gt;&gt;2; SensorArray[1] = (value&amp;0x02)&gt;&gt;1; SensorArray[0] = (value&amp;0x01)&gt;&gt;0;    2. UIFlow To get complete code, please click&nbsp;here。  &nbsp; More information Schematic   PinMap    M5Core(GROVE A) GPIO22 GPIO21 5V GND   TRACE Unit SCL SDA 5V GND    ","vendor":"Little Bird","product_type":"physical","in_stock":false,"options":[],"variants":[{"id":4804,"title":"Default Title","sku":"M5-A048","price":21.35,"compare_at_price":0.0,"on_sale":false,"in_stock":false,"available_quantity":0,"option1":"Default Title"}]}