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:9e70f16bc114, 2009-09-03 (annotated)
- Committer:
- simon
- Date:
- Thu Sep 03 12:51:32 2009 +0000
- Revision:
- 0:9e70f16bc114
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| simon | 0:9e70f16bc114 | 1 | // example using same pin as analog and digital, sford |
| simon | 0:9e70f16bc114 | 2 | |
| simon | 0:9e70f16bc114 | 3 | #include "mbed.h" |
| simon | 0:9e70f16bc114 | 4 | |
| simon | 0:9e70f16bc114 | 5 | float do_something_analog() { |
| simon | 0:9e70f16bc114 | 6 | AnalogIn x(p20); |
| simon | 0:9e70f16bc114 | 7 | return x.read(); |
| simon | 0:9e70f16bc114 | 8 | } |
| simon | 0:9e70f16bc114 | 9 | |
| simon | 0:9e70f16bc114 | 10 | void do_something_digital() { |
| simon | 0:9e70f16bc114 | 11 | DigitalOut x(p20); |
| simon | 0:9e70f16bc114 | 12 | x = 1; |
| simon | 0:9e70f16bc114 | 13 | wait(0.5); |
| simon | 0:9e70f16bc114 | 14 | x = 0; |
| simon | 0:9e70f16bc114 | 15 | } |
| simon | 0:9e70f16bc114 | 16 | |
| simon | 0:9e70f16bc114 | 17 | int main() { |
| simon | 0:9e70f16bc114 | 18 | while(1) { |
| simon | 0:9e70f16bc114 | 19 | do_something_analog(); |
| simon | 0:9e70f16bc114 | 20 | do_something_digital(); |
| simon | 0:9e70f16bc114 | 21 | } |
| simon | 0:9e70f16bc114 | 22 | } |