Microbit random LED matrix blink

Dependencies:   mbed

main.cpp

Committer:
appa
Date:
18 months ago
Revision:
0:ea2f8a21085d

File content as of revision 0:ea2f8a21085d:

#include "mbed.h"

DigitalOut C[] = {(COL1), (COL2),(COL3)};
DigitalOut R[] = {(ROW1), (ROW2),(ROW3)};

int main() {
    int col = 0;
    int row = 0;
    
    while(1) {
        col = rand() % 2;
        row = rand() % 2;
        C[col] - 0;
        R[row] = 1;
        wait(0.9);
        R[row] = 0;
        C[col] = 1;
    }
}