The forklift will communicate over i2c with the ARM. Its slave address is the same as its Tracking ID, which at the moment is 0x41. With i2c, a master device (the ARM) first sends a slave address it wants to communicate with as 7 bits, then 1 bit indicating whether it wants to read from or write to the slave. To read data from the forklift, the ARM should first write a byte to the forklift indicating the index of what it wants to receive, then address the forklift for reading. The forklift will automatically increment the read index, so that the ARM can request multiple bytes at once. To write a value to the forklift, the ARM should write two bytes, the first indicating the index and the second being the data to write. Only the height setpoint is currently writable.
Sample write sequence:
start addr+w index data stop
Sample read sequence:
start addr+w index stop start addr+r [data] stop
Indexes for data:
#define FORKLIFT_TRACKING_ID 0 // always 0x41 #define FORKLIFT_SERIAL_NUMBER 1 // unique to each forklift #define FORKLIFT_HEIGHT 2 #define FORKLIFT_HEIGHT_SETPOINT 3 // only one that's r/w #define FORKLIFT_FORCE 4