Now we have a binary number saved in our line marker array. But to retrieve the number from the letters array, we need the index number as a decimal value. In order to do that, we'll write a function that converts binary to decimal, and we'll call it bin convert. Each index of the five element array corresponds to a column of the five bit binary number we saved. And each column of a binary number has a different value. Two to the power of zero is one, two to the power of one is to two to the power of two is four, two to the power of three, eight, and two to the power of four is 16.
We'll multiply each column by the corresponding power of two and then add the results. A number will only be added if the sensor reads One in that index position. If the sensor reads zero, the number will be multiplied with zero and thus remains zero. This function will return the converted decimal number. And we'll use that number to retrieve the corresponding letter in that index in the letters array.