Controlling a Grove LED bar (D5) with a Grove button (A0).
main.cpp
- Committer:
- jplunkett
- Date:
- 2016-08-16
- Revision:
- 0:c7741b38fc0f
- Child:
- 1:38445b7f8db8
File content as of revision 0:c7741b38fc0f:
#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.2);
if (button) {
bar.setLevel(j++);
} else {
bar.setLevel(j);
}
if (j == 11) {
bar.setLevel(0);
j = 0;
}
}
}
Jenny Plunkett