Microbit random LED matrix blink
Embed:
(wiki syntax)
Show/hide line numbers
main.cpp
00001 #include "mbed.h" 00002 00003 DigitalOut C[] = {(COL1), (COL2),(COL3)}; 00004 DigitalOut R[] = {(ROW1), (ROW2),(ROW3)}; 00005 00006 int main() { 00007 int col = 0; 00008 int row = 0; 00009 00010 while(1) { 00011 col = rand() % 2; 00012 row = rand() % 2; 00013 C[col] - 0; 00014 R[row] = 1; 00015 wait(0.9); 00016 R[row] = 0; 00017 C[col] = 1; 00018 } 00019 }
Generated on Sun Dec 4 2022 20:06:21 by
1.7.2