Chris Styles
/
app-board-USB-printf
Example program to print 100 samples of pot1 on the mbed Application Board to the USB serial port
main.cpp@0:e762099aba67, 2013-04-18 (annotated)
- Committer:
- chris
- Date:
- Thu Apr 18 12:48:24 2013 +0000
- Revision:
- 0:e762099aba67
First revision
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
chris | 0:e762099aba67 | 1 | #include "mbed.h" |
chris | 0:e762099aba67 | 2 | |
chris | 0:e762099aba67 | 3 | AnalogIn pot1(p19); |
chris | 0:e762099aba67 | 4 | DigitalOut myled(LED1); |
chris | 0:e762099aba67 | 5 | |
chris | 0:e762099aba67 | 6 | int main() |
chris | 0:e762099aba67 | 7 | { |
chris | 0:e762099aba67 | 8 | |
chris | 0:e762099aba67 | 9 | for (int i=0; i < 100 ; i++) { |
chris | 0:e762099aba67 | 10 | printf("%.2f\n",pot1.read()); |
chris | 0:e762099aba67 | 11 | wait(0.05); |
chris | 0:e762099aba67 | 12 | myled = !myled; |
chris | 0:e762099aba67 | 13 | } |
chris | 0:e762099aba67 | 14 | myled = 1; |
chris | 0:e762099aba67 | 15 | |
chris | 0:e762099aba67 | 16 | } |