0

https://www.arduino.cc/en/Tutorial/RowColumnScanning

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

2

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.