led.ino (468B) download
1#include "include/config.h"
2#include "include/led.h"
3
4static bool colors[][3] = {
5 [COLOR_NONE] = { 0, 0, 0 },
6 [COLOR_RED] = { 1, 0, 0 },
7 [COLOR_GREEN] = { 0, 1, 0 },
8 [COLOR_BLUE] = { 0, 0, 1 },
9 [COLOR_YELLOW] = { 1, 1, 0 },
10 [COLOR_CYAN] = { 0, 1, 1 },
11 [COLOR_MAGENTA] = { 1, 0, 1 },
12 [COLOR_WHITE] = { 1, 1, 1 },
13};
14
15void writeLED(color c) {
16 digitalWrite(ledRed, !colors[c][0]);
17 digitalWrite(ledGreen, !colors[c][1]);
18 digitalWrite(ledBlue, !colors[c][2]);
19}