Demonstrate digital input and for loops

Dependencies:   mbed

abcs.cpp

Committer:
ethanharstad
Date:
2014-06-01
Revision:
0:93dd561b0067
Child:
1:304bb8817c1d

File content as of revision 0:93dd561b0067:

#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");
    }
}