|
| 1 | +#include "LEDMatrix.h" |
| 2 | +#include "hw_bridge.h" |
| 3 | +#include "mbed.h" |
| 4 | + |
| 5 | +int main() { |
| 6 | + printf("####### STARTING LED MATRIX TEST #######\r\n"); |
| 7 | + |
| 8 | + LEDMatrix blinky(D8, D9, D10); |
| 9 | + |
| 10 | + while (true) { |
| 11 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_RED); |
| 12 | + ThisThread::sleep_for(5s); |
| 13 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_BLUE); |
| 14 | + ThisThread::sleep_for(5s); |
| 15 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_GREEN); |
| 16 | + ThisThread::sleep_for(5s); |
| 17 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 18 | + ThisThread::sleep_for(5s); |
| 19 | + |
| 20 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::FLASHING_RED); |
| 21 | + ThisThread::sleep_for(5s); |
| 22 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::FLASHING_BLUE); |
| 23 | + ThisThread::sleep_for(5s); |
| 24 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::FLASHING_GREEN); |
| 25 | + ThisThread::sleep_for(5s); |
| 26 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 27 | + ThisThread::sleep_for(5s); |
| 28 | + |
| 29 | + blinky.setFlashColor(1, 0, 0); // red |
| 30 | + ThisThread::sleep_for(5s); |
| 31 | + blinky.setFlashColor(0, 1, 0); // green |
| 32 | + ThisThread::sleep_for(5s); |
| 33 | + blinky.setFlashColor(0, 0, 1); // blue |
| 34 | + ThisThread::sleep_for(5s); |
| 35 | + |
| 36 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 37 | + ThisThread::sleep_for(5s); |
| 38 | + blinky.setSolidColor(1, 0, 0); // red |
| 39 | + ThisThread::sleep_for(5s); |
| 40 | + blinky.setSolidColor(0, 1, 0); // green |
| 41 | + ThisThread::sleep_for(5s); |
| 42 | + blinky.setSolidColor(0, 0, 1); // blue |
| 43 | + ThisThread::sleep_for(5s); |
| 44 | + |
| 45 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 46 | + ThisThread::sleep_for(5s); |
| 47 | + blinky.setFlashColor(1, 0, 1); // purple |
| 48 | + ThisThread::sleep_for(5s); |
| 49 | + blinky.setFlashColor(1, 1, 0); // brownish |
| 50 | + ThisThread::sleep_for(5s); |
| 51 | + blinky.setFlashColor(0, 1, 1); // blue-green |
| 52 | + ThisThread::sleep_for(5s); |
| 53 | + |
| 54 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 55 | + ThisThread::sleep_for(5s); |
| 56 | + blinky.setSolidColor(1, 0, 1); // purple |
| 57 | + ThisThread::sleep_for(5s); |
| 58 | + blinky.setSolidColor(1, 1, 0); // brownish |
| 59 | + ThisThread::sleep_for(5s); |
| 60 | + blinky.setSolidColor(0, 1, 1); // blue-green |
| 61 | + ThisThread::sleep_for(5s); |
| 62 | + |
| 63 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_RED); |
| 64 | + ThisThread::sleep_for(5s); |
| 65 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::FLASHING_GREEN); |
| 66 | + ThisThread::sleep_for(5s); |
| 67 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_BLUE); |
| 68 | + ThisThread::sleep_for(5s); |
| 69 | + |
| 70 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::FLASHING_GREEN); |
| 71 | + ThisThread::sleep_for(5s); |
| 72 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_BLUE); |
| 73 | + ThisThread::sleep_for(5s); |
| 74 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::SOLID_RED); |
| 75 | + ThisThread::sleep_for(5s); |
| 76 | + blinky.setState(HWBRIDGE::LEDMATRIX::LEDMatrixState::OFF); |
| 77 | + } |
| 78 | +} |
0 commit comments