to verify the position of the LEDs

Dependencies:   mbed

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.

Committer:
matroxmike
Date:
Tue Oct 22 15:00:47 2019 +1100
Revision:
7:0f62c513f003
Parent:
6:83feebd43ec8
Child:
8:7a49220aaa22
rename myled to row

Who changed what in which revision?

UserRevisionLine numberNew 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);
matroxmike 7:0f62c513f003 27 //DigitalOut row3(P0_15); // something
matrixmike 4:0dc3e04090ab 28
matroxmike 7:0f62c513f003 29 DigitalOut row1(P0_13); // something
matroxmike 7:0f62c513f003 30 DigitalOut row2(P0_14); // guessing the layout of the LEDs ATM
matroxmike 7:0f62c513f003 31 DigitalOut row3(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 // }
matroxmike 7:0f62c513f003 38
matroxmike 7:0f62c513f003 39 row3 = 1;
matroxmike 7:0f62c513f003 40
matrixmike 0:699a0e5dc3ab 41 wait(0.2);
matroxmike 7:0f62c513f003 42
matroxmike 7:0f62c513f003 43 row3 = 0;
matroxmike 7:0f62c513f003 44
matrixmike 0:699a0e5dc3ab 45 wait(0.2);
matrixmike 6:83feebd43ec8 46 // **
matroxmike 7:0f62c513f003 47 row2 = 1;
matroxmike 7:0f62c513f003 48
matrixmike 5:7881d6e0732f 49 wait(0.2);
matroxmike 7:0f62c513f003 50
matroxmike 7:0f62c513f003 51 row2 = 0;
matroxmike 7:0f62c513f003 52
matrixmike 5:7881d6e0732f 53 wait(0.2);
matrixmike 6:83feebd43ec8 54 // **
matroxmike 7:0f62c513f003 55 row1 = 1;
matroxmike 7:0f62c513f003 56
matrixmike 6:83feebd43ec8 57 wait(0.2);
matroxmike 7:0f62c513f003 58
matroxmike 7:0f62c513f003 59 row1 = 0;
matroxmike 7:0f62c513f003 60
matrixmike 6:83feebd43ec8 61 wait(0.2);
matrixmike 6:83feebd43ec8 62 // **
matrixmike 2:71c7441b477a 63 //}
matrixmike 2:71c7441b477a 64 // for (int cv = 0; cv < 3 ; cv++) {
matrixmike 2:71c7441b477a 65 // myLedBlink(cv);
matrixmike 2:71c7441b477a 66 // }
matrixmike 0:699a0e5dc3ab 67 }
matroxmike 7:0f62c513f003 68 }