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
- The receiver is marked TX, RX: on the Universal I2C edition RX is SDA and TX is SCL. The receiver has a built-in level shifter, so 5 V and 3.3 V boards can both connect directly.
- PS2: switch the gamepad on and it connects. Press the ANALOG button in the middle of the gamepad so its light is on (analog mode); only then do the sticks give numbers. PS4 / PS5: pair it the first time. Within 30 seconds after the receiver powers on (or after you press its Reset button), hold SHARE + PS on a PS4 gamepad or Create + PS on a PS5 gamepad until the light bar blinks fast. After that, pressing PS connects it automatically.
- 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).