Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
main.cpp@0:909e35b48b7d, 2013-07-04 (annotated)
- Committer:
- ogata_lab
- Date:
- Thu Jul 04 03:24:53 2013 +0000
- Revision:
- 0:909e35b48b7d
First Commit;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ogata_lab | 0:909e35b48b7d | 1 | #include "mbed.h" |
ogata_lab | 0:909e35b48b7d | 2 | #include "Serial.h" |
ogata_lab | 0:909e35b48b7d | 3 | |
ogata_lab | 0:909e35b48b7d | 4 | AnalogIn ain01(p19); |
ogata_lab | 0:909e35b48b7d | 5 | DigitalIn sw01(p20); |
ogata_lab | 0:909e35b48b7d | 6 | Serial usbSerial(USBTX, USBRX); |
ogata_lab | 0:909e35b48b7d | 7 | |
ogata_lab | 0:909e35b48b7d | 8 | int main() { |
ogata_lab | 0:909e35b48b7d | 9 | |
ogata_lab | 0:909e35b48b7d | 10 | sw01.mode(PullUp); |
ogata_lab | 0:909e35b48b7d | 11 | int i = 0; |
ogata_lab | 0:909e35b48b7d | 12 | while(1) { |
ogata_lab | 0:909e35b48b7d | 13 | int sw = sw01; |
ogata_lab | 0:909e35b48b7d | 14 | float analog = ain01; |
ogata_lab | 0:909e35b48b7d | 15 | usbSerial.printf("%d, %f\r\n", sw, analog); |
ogata_lab | 0:909e35b48b7d | 16 | wait(0.01); |
ogata_lab | 0:909e35b48b7d | 17 | } |
ogata_lab | 0:909e35b48b7d | 18 | } |