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
- Mount the sensor flat on the robot with the board's printed X axis pointing to the front. Keep the robot still for about 0.5 s at power-on; it learns which side is up and zeroes itself.
- 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).