Not sure how to determine that.
Then what you need to do is record when each HIGH to LOW and LOW to HIGH transition occurs. The time between the first and last transition defines the overall bar code length. Then, you can use the intermediate times to decide how wide a bar was. There are a fixed number of bars possible if the encoded number was 10101010101...01010. Knowing how many bars are possible defines the width of a bar (time-wise). Then, you can use the actual width to figure out how many 0s or 1s were read.