This code really confused me because I don't know if the pixels[x][y] is HIGH or LOW in void refreshScreen().

As you look at the code, pixels[x][y] is HIGH and then LOW in void setup(), and then pixels[x][y] is HIGH again in void loop(). Could anyone explain this to me, please?

1 Answer 1


The pixels array in initialized to all HIGH in setup(). Then one element of the pixel array is set to LOW in readSensors() which turns on one LED.

The tricky bit is you have to remember to turn off the previous LED. That is why in readSensors() there is the line where an element of pixels is set HIGH while the pixels' array pointers are still pointing at the former (already lit) LED.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.