A simple xy() function to turn display matrix coordinates into the index numbers OctoWS2811 requires. If your LEDs are arranged differently, edit this code...
| 84 | // into the index numbers OctoWS2811 requires. If your LEDs |
| 85 | // are arranged differently, edit this code... |
| 86 | unsigned int xy(unsigned int x, unsigned int y) { |
| 87 | if ((y & 1) == 0) { |
| 88 | // even numbered rows (0, 2, 4...) are left to right |
| 89 | return y * matrix_width + x; |
| 90 | } else { |
| 91 | // odd numbered rows (1, 3, 5...) are right to left |
| 92 | return y * matrix_width + matrix_width - 1 - x; |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | // Run repetitively |
| 97 | void loop() { |