Microbit random LED matrix blink

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
appa
Date:
Sun Dec 04 20:05:25 2022 +0000
Commit message:
microbit random led matrix

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Sun Dec 04 20:05:25 2022 +0000
@@ -0,0 +1,19 @@
+#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;
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Sun Dec 04 20:05:25 2022 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/mbed_official/code/mbed/builds/65be27845400
\ No newline at end of file