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:
matrixmike
Date:
Mon Oct 21 13:16:12 2019 +0000
Revision:
2:71c7441b477a
Parent:
1:bd2be1824e78
Child:
3:c6d14249d784
a poor attempt to address individual LEDs

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 2:71c7441b477a 17
matrixmike 0:699a0e5dc3ab 18 DigitalOut col0(P0_4, 0);
matrixmike 0:699a0e5dc3ab 19
matrixmike 2:71c7441b477a 20 DigitalOut myled3(P0_15); // something
matrixmike 2:71c7441b477a 21 DigitalOut myled4(P0_11); // something
matrixmike 1:bd2be1824e78 22 DigitalOut myled1(P0_13); // something
matrixmike 1:bd2be1824e78 23 DigitalOut myled2(P0_14); // guessing the layout of the LEDs ATM
matrixmike 2:71c7441b477a 24
matrixmike 0:699a0e5dc3ab 25 int main()
matrixmike 0:699a0e5dc3ab 26 {
matrixmike 0:699a0e5dc3ab 27 while(1) {
matrixmike 2:71c7441b477a 28 for (int cv = 0; cv < 4 ; cv++) {
matrixmike 2:71c7441b477a 29 myLedBlink(seq[cv]);
matrixmike 2:71c7441b477a 30 }
matrixmike 0:699a0e5dc3ab 31 myled1 = 1;
matrixmike 0:699a0e5dc3ab 32 myled2 = 1;
matrixmike 1:bd2be1824e78 33 myled3 = 1;
matrixmike 2:71c7441b477a 34 myled4 = 1;
matrixmike 0:699a0e5dc3ab 35 wait(0.2);
matrixmike 0:699a0e5dc3ab 36 myled1 = 0;
matrixmike 0:699a0e5dc3ab 37 myled2 = 0;
matrixmike 1:bd2be1824e78 38 myled3 = 0;
matrixmike 2:71c7441b477a 39 myled4 = 0;
matrixmike 0:699a0e5dc3ab 40 wait(0.2);
matrixmike 2:71c7441b477a 41 //}
matrixmike 2:71c7441b477a 42 // for (int cv = 0; cv < 3 ; cv++) {
matrixmike 2:71c7441b477a 43 // myLedBlink(cv);
matrixmike 2:71c7441b477a 44 // }
matrixmike 0:699a0e5dc3ab 45 }
matrixmike 2:71c7441b477a 46 }