Encoder of 3 bits of resolution

This is my very first time using arduino. I want to make an encoder of 3 bits of resolution, that will give me only 7 positions. Using photo sensors like this video:

My issue here is the code, I do not know how to do it.
Please please please help

3 bits is 8 values

000
001
010
011
100
101
110
111

not sure about your question though? if you want finer grain rotation angles (his was 45°) then you need just more holes and pikes on your encoding wheel.

some toy cars come with encoding wheels looking like this

how can I make the code in arduino?

What type of sensing device do you have? Something with 2 sensor or just one?

If this is just one, you get a high signal at every hole and a low signal at every spike on the wheel. Just connecting the signal to an interrupt for CHANGE and you get an interrupt for every event.

If this is 2 then read about rotary or "shaft" encoder