2023-12-14 17:36:21 -07:00
# Summary
2023-12-14 18:30:07 -07:00
Arduino field control for vex V5. v5_field_control.ino contains the code to control a single robot over an arduino with two serial ports.
2023-12-14 17:36:21 -07:00
2023-12-12 21:18:14 -07:00
# Setup
2023-12-14 17:32:59 -07:00
Connect Arduino TX2 & RX2 to DI & RO of the Max485.
2023-12-12 20:56:11 -07:00
2023-12-14 17:32:59 -07:00
Connect Arduino D23(or whatever read_line is set to) to RE/DE.
2023-12-12 21:18:14 -07:00
2023-12-14 17:32:59 -07:00
Power Max485 with 5V and GND connected to the Arduino.
2023-12-12 21:18:14 -07:00
2023-12-14 17:32:59 -07:00
Flash the code onto the Arduino, connect A& B of the smart cable connected to the controller(aka the black and red wires respectively) to the Max485.
2023-12-12 21:18:14 -07:00
2023-12-14 19:41:04 -07:00
Viewing the USB serial of the Arduino, send 0xAB01234567-like hex sequences to update the configured state to 0xAB and the timer to 0x01234567.
2023-12-12 21:18:14 -07:00
2023-12-14 17:36:21 -07:00
# Info
2023-12-12 21:18:14 -07:00
Known States:
- 0xC9 : paused
- 0xE1 : driver competition
- 0xD1 : auton competition
- 0x61 : driver skills
- 0x51 : auton skills
2023-12-14 17:15:57 -07:00
From this the flags are thus:
2023-12-14 17:34:11 -07:00
- 0: ? - always 1
- 1-3: ? - always 0
- 4-5: mode - 0 for paused, 1 for auton, 2 for driver,
- 6: ? - always 1
- 7: 0 for skills - 1 for competition
2023-12-14 17:15:57 -07:00
The field control sequence(aka when the controller sends 0xA7) can be responded to with either a 0x02 ACK packet to acknowledge that the current values are correct, or a 0x53 packet to send new values. However, a 0x02 must be sent at least every 20 packets else the controller will restart the connect sequence.
All of the protocol reversing has been done with 1 brain & 1 controller, so any unique fields are constant and will need to be updated.
2023-12-14 17:32:59 -07:00
connection.txt has my notes from reversing the protocol, and notes.txt is my summarized reminder of how the protocol works at a high level.