to verify the position of the LEDs
This is an attempt to address all the 25 LEDs. This has been done but only on rows. I need to arrange the column calls in some form of array which can be indexed.
main.cpp@4:0dc3e04090ab, 2019-10-22 (annotated)
- Committer:
- matrixmike
- Date:
- Tue Oct 22 03:33:46 2019 +0000
- Revision:
- 4:0dc3e04090ab
- Parent:
- 3:c6d14249d784
- Child:
- 5:7881d6e0732f
Row15 along with Columns 1 to 9
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
matrixmike | 0:699a0e5dc3ab | 1 | #include "mbed.h" |
matrixmike | 0:699a0e5dc3ab | 2 | /* |
matrixmike | 0:699a0e5dc3ab | 3 | * All the LEDs on the micro:bit are part of the LED Matrix, |
matrixmike | 0:699a0e5dc3ab | 4 | * In order to get simple blinking behaviour, we set column 0 |
matrixmike | 0:699a0e5dc3ab | 5 | * to be permanently at ground. If you want to use the LEDs as |
matrixmike | 0:699a0e5dc3ab | 6 | * a screen, there is a display driver in the micro:bit 'DAL', |
matrixmike | 0:699a0e5dc3ab | 7 | */ |
matrixmike | 0:699a0e5dc3ab | 8 | // 21 Oct 2019 |
matrixmike | 2:71c7441b477a | 9 | int seq[5] = {P0_15,P0_13,P0_14,P0_11}; |
matrixmike | 2:71c7441b477a | 10 | void myLedBlink(int led) |
matrixmike | 2:71c7441b477a | 11 | { |
matrixmike | 2:71c7441b477a | 12 | led = 1; |
matrixmike | 2:71c7441b477a | 13 | wait(0.2); |
matrixmike | 2:71c7441b477a | 14 | led = 0; |
matrixmike | 2:71c7441b477a | 15 | wait(0.2); |
matrixmike | 2:71c7441b477a | 16 | } |
matrixmike | 3:c6d14249d784 | 17 | // https://www.iot-programmer.com/index.php/books/27-micro-bit-iot-in-c/chapters-micro-bit-iot-in-c/54-micro-bit-iot-in-c-the-led-display |
matrixmike | 4:0dc3e04090ab | 18 | DigitalOut col1(P0_4,0); |
matrixmike | 4:0dc3e04090ab | 19 | DigitalOut col2(P0_5,0); |
matrixmike | 3:c6d14249d784 | 20 | DigitalOut col3(P0_6,0); |
matrixmike | 4:0dc3e04090ab | 21 | DigitalOut col4(P0_7,0); |
matrixmike | 4:0dc3e04090ab | 22 | DigitalOut col5(P0_8,0); |
matrixmike | 4:0dc3e04090ab | 23 | DigitalOut col6(P0_9,0); |
matrixmike | 4:0dc3e04090ab | 24 | DigitalOut col7(P0_10,0); |
matrixmike | 4:0dc3e04090ab | 25 | DigitalOut col8(P0_11,0); |
matrixmike | 4:0dc3e04090ab | 26 | DigitalOut col9(P0_12,0); |
matrixmike | 4:0dc3e04090ab | 27 | //DigitalOut myled3(P0_15); // something |
matrixmike | 4:0dc3e04090ab | 28 | |
matrixmike | 1:bd2be1824e78 | 29 | DigitalOut myled1(P0_13); // something |
matrixmike | 1:bd2be1824e78 | 30 | DigitalOut myled2(P0_14); // guessing the layout of the LEDs ATM |
matrixmike | 4:0dc3e04090ab | 31 | DigitalOut myled3(P0_15); // something |
matrixmike | 0:699a0e5dc3ab | 32 | int main() |
matrixmike | 0:699a0e5dc3ab | 33 | { |
matrixmike | 0:699a0e5dc3ab | 34 | while(1) { |
matrixmike | 4:0dc3e04090ab | 35 | // for (int cv = 0; cv < 4 ; cv++) { |
matrixmike | 4:0dc3e04090ab | 36 | // myLedBlink(seq[cv]); |
matrixmike | 4:0dc3e04090ab | 37 | // } |
matrixmike | 4:0dc3e04090ab | 38 | // myled1 = 1; |
matrixmike | 4:0dc3e04090ab | 39 | // myled2 = 1; |
matrixmike | 1:bd2be1824e78 | 40 | myled3 = 1; |
matrixmike | 4:0dc3e04090ab | 41 | // myled4 = 1; |
matrixmike | 0:699a0e5dc3ab | 42 | wait(0.2); |
matrixmike | 4:0dc3e04090ab | 43 | // myled1 = 0; |
matrixmike | 4:0dc3e04090ab | 44 | // myled2 = 0; |
matrixmike | 1:bd2be1824e78 | 45 | myled3 = 0; |
matrixmike | 4:0dc3e04090ab | 46 | // myled4 = 0; |
matrixmike | 0:699a0e5dc3ab | 47 | wait(0.2); |
matrixmike | 2:71c7441b477a | 48 | //} |
matrixmike | 2:71c7441b477a | 49 | // for (int cv = 0; cv < 3 ; cv++) { |
matrixmike | 2:71c7441b477a | 50 | // myLedBlink(cv); |
matrixmike | 2:71c7441b477a | 51 | // } |
matrixmike | 0:699a0e5dc3ab | 52 | } |
matrixmike | 2:71c7441b477a | 53 | } |