Best program ever.
Dependencies: mbed
main.cpp@0:023746835c73, 2018-09-20 (annotated)
- Committer:
- gard0110
- Date:
- Thu Sep 20 18:37:13 2018 +0000
- Revision:
- 0:023746835c73
Program B
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
gard0110 | 0:023746835c73 | 1 | #include "mbed.h" |
gard0110 | 0:023746835c73 | 2 | |
gard0110 | 0:023746835c73 | 3 | |
gard0110 | 0:023746835c73 | 4 | int main() { |
gard0110 | 0:023746835c73 | 5 | |
gard0110 | 0:023746835c73 | 6 | DigitalOut led[5] = {p26, p27, p28, p29, p30}; |
gard0110 | 0:023746835c73 | 7 | |
gard0110 | 0:023746835c73 | 8 | int x; |
gard0110 | 0:023746835c73 | 9 | |
gard0110 | 0:023746835c73 | 10 | while(1){ |
gard0110 | 0:023746835c73 | 11 | x = (rand() %5); |
gard0110 | 0:023746835c73 | 12 | led[x] = 1; |
gard0110 | 0:023746835c73 | 13 | wait(1); |
gard0110 | 0:023746835c73 | 14 | led[x] = 0; |
gard0110 | 0:023746835c73 | 15 | } |
gard0110 | 0:023746835c73 | 16 | } |
gard0110 | 0:023746835c73 | 17 |