Reflective sensors comparing data

Hi i need help with this project, i have little experience programming i been stuck with this for 2 weeks and nothing seem to work. Maybe the logic isn’t the right one.

What i´m trying to do is sensing with 4 sensors if there is something on them and comparing the data. The process is as follow:

First i press a switch that indicates the time of the first lecture and “save” the data in an array (i convert the data into 1 and 0 to be easier to compare the arrays), after a while i press a second switch that is when i want to “compare”, this data will now save in another array, after that i subtract both arrays and print the “1” into led indicating the position in the array where there is an object.

The problem that i have is that i can’t save the data, when i press the switch only keeps spamming what the sensor is reading instead of storing the data.

i tried adding a timer but it doesn’t work.

code.txt (2 KB)