Read a code with two TRCT5000 with a slow slot car

I’m working on a project with small cars that are following tracks (nearly the same as slot cars).
They are going slowly (4 meters/minute maximum), they have a stepper motor 28byj-48.
On the track, there are switches and i want to know where is the car on the track.
My idea was to place two TCR5000L on the back of the car and reading a type of barcode (see attachment).

Column on the left will be reading by one of the module and will detect change of state. Right column will define the value.
A code will always start with a black square on the left and white square on the right.
So here we will have the value (White = 1, black = 0) : 0110100 => 52
Before starting to code this, i wanted to know if something with the same idea already exists or if i can re-use C libraries (finally, it’s nearly the same as signals of communications protocol).
Sorry, for my english, hope you will understand everything.
Thanks !