Wire it up and paste the helper
Arduino talks to the sensor over I2C (4 wires). You do not need to install a library. Write 2 lines at the very top and paste a "helper" at the very bottom. Then you can read values with mbcRead() and send commands with mbcWrite().
Which board do you use? (Only the SDA / SCL pins change. The program is the same.)
- Unplug the USB cable before wiring. Use the Universal I2C edition (the SPIKE and EV3 editions have different firmware and cannot connect to Arduino).
- Sensor VCC → 5V, GND → GND
- Sensor SDA → A4, SCL → A5
- On the SharpShot connector, IO3 = SDA and IO1 = SCL. The SharpShot must have the WRO edition (HUE12) I2C firmware: the EV3 and SPIKE editions use the same pins for serial, so it is one or the other.
- Set up the colour spots on the SharpShot first: with the screen and buttons on the back, turn on the spots S1–S12 you need and aim them at the mat. The settings are stored on the device. The Arduino only reads the results; a program cannot change them.
- Open the Arduino IDE: File → New, and delete what is already there.
- Write lines 1 and 2 at the very top. Paste the "helper" at the very bottom (marked ① in the program on the right; "Copy program" copies it too).