Demonstrate digital input and for loops
Dependencies: mbed
Diff: abcs.cpp
- Revision:
- 0:93dd561b0067
- Child:
- 1:304bb8817c1d
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/abcs.cpp Sun Jun 01 22:01:18 2014 +0000 @@ -0,0 +1,16 @@ +#include "mbed.h" + +Serial pc(USBTX, USBRX); +DigitalIn btn(USER_BUTTON); + +int main() { + while(true) { + pc.printf("Press the button.\n"); + while(btn != 0); + for(int i = 'a'; i <= 'z'; i++) { + pc.printf("%c", i); + wait(0.1); + } + pc.printf("\n"); + } +} \ No newline at end of file