Jenny Plunkett
/
LED_bar_button_control
Controlling a Grove LED bar (D5) with a Grove button (A0).
main.cpp
- Committer:
- jplunkett
- Date:
- 2016-08-16
- Revision:
- 1:38445b7f8db8
- Parent:
- 0:c7741b38fc0f
File content as of revision 1:38445b7f8db8:
#include "mbed.h" #include "LED_Bar.h" LED_Bar bar(D6, D5); DigitalIn button(A0); int main() { int j; bar.setLevel(0); while(1) { wait(0.3); if (button) { bar.setLevel(j++); } else { bar.setLevel(j); } if (j == 11) { bar.setLevel(0); j = 0; } } }