Robot_Principal_2024-2025/main controller code
Ulysse Cura ee8a1b9616 Corrected gyro, it's now functionnal ! 2025-05-07 21:12:37 +02:00
..
.vscode Added code for gyro, still some huge bugs 2025-05-07 20:35:58 +02:00
last Started main controller code (copied useful files from motion controller) 2025-05-04 18:06:22 +02:00
src Corrected gyro, it's now functionnal ! 2025-05-07 21:12:37 +02:00
CMakeLists.txt Creating new files and code structure for main controller 2025-05-06 21:33:11 +02:00
Readme.md Changing main controller README 2025-05-06 21:32:33 +02:00
pico_sdk_import.cmake Started main controller code (copied useful files from motion controller) 2025-05-04 18:06:22 +02:00

Readme.md

Motion controler code for the RPI Pico (RP2040)

This project is the main controller firmware for the RPI Pico (RP2040), designed for the Eurobot 2025 Cup.

I2C description

The robots I2C communication works as follows:

  • Send the device address + R/W bit (to select read or write mode).
  • Send the target register address (to read from or write to).
  • Read or write the register data. Multiple registers can be read/written sequentially, with the address auto-incrementing after each operation.

This code is designed to be the master in the i2c communication.

Adress R/W Description Encoding
0x00 W Speed motor 1 -128 - 127
0x01 W Speed motor 2 -128 - 127
0x02 W Speed motor 3 -128 - 127
0x03 W Speed motor 4 -128 - 127
0x04 W Servo 1 position selection 0 - 1
0x05 W Servo 2 position selection 0 - 1
0x06 W Servo 3 position selection 0 - 1
0x07 W Servo 4 position selection 0 - 1

Motors communication description

Motors are «connected» to their respective I2C buffer address.

To control a motor you need to write data to its adress of the form :

int8_t speed;

Value goes from -128 to 127.

Servo motors communication description

Servo motors are «connected» to their respective I2C buffer address.

To control a servo motor you need to write data to its adress of the form :

uint8_t close;

Value is 0 or 1 for the open or the close pos.

Pinout description

Pin Description GPIO Type
4 I2C Bus SDA I2C
5 I2C Bus SCL I2C