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.
Dependencies: mbed
main.cpp@2:e05f61e0fa4b, 2015-01-29 (annotated)
- Committer:
- psahay
- Date:
- Thu Jan 29 20:43:51 2015 +0000
- Revision:
- 2:e05f61e0fa4b
- Parent:
- 1:79bb0caaa231
- Child:
- 3:e2894353eac5
Part1 done
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| jaredwil | 0:4e99e4caf232 | 1 | #include "mbed.h" |
| psahay | 1:79bb0caaa231 | 2 | #include "math.h" |
| jaredwil | 0:4e99e4caf232 | 3 | |
| psahay | 2:e05f61e0fa4b | 4 | DigitalOut myled1(LED1); |
| psahay | 2:e05f61e0fa4b | 5 | DigitalOut myled2(LED2); |
| psahay | 2:e05f61e0fa4b | 6 | DigitalIn pound(p25); //Not sure if this will work labled (analog input) |
| psahay | 2:e05f61e0fa4b | 7 | DigitalIn two(p23); //^ |
| psahay | 2:e05f61e0fa4b | 8 | |
| psahay | 2:e05f61e0fa4b | 9 | void toggle(DigitalOut led); |
| psahay | 2:e05f61e0fa4b | 10 | |
| jaredwil | 0:4e99e4caf232 | 11 | |
| jaredwil | 0:4e99e4caf232 | 12 | int main() { |
| jaredwil | 0:4e99e4caf232 | 13 | while(1) { |
| psahay | 2:e05f61e0fa4b | 14 | if(pound == 1) |
| psahay | 2:e05f61e0fa4b | 15 | { |
| psahay | 2:e05f61e0fa4b | 16 | toggle(myled1); |
| psahay | 2:e05f61e0fa4b | 17 | } |
| psahay | 2:e05f61e0fa4b | 18 | if(two == 1) |
| psahay | 2:e05f61e0fa4b | 19 | { |
| psahay | 2:e05f61e0fa4b | 20 | toggle(myled2); |
| psahay | 2:e05f61e0fa4b | 21 | } |
| psahay | 2:e05f61e0fa4b | 22 | wait(0.1); |
| jaredwil | 0:4e99e4caf232 | 23 | } |
| jaredwil | 0:4e99e4caf232 | 24 | } |
| psahay | 2:e05f61e0fa4b | 25 | |
| psahay | 2:e05f61e0fa4b | 26 | void toggle(DigitalOut led) |
| psahay | 2:e05f61e0fa4b | 27 | { |
| psahay | 2:e05f61e0fa4b | 28 | led =! led; |
| psahay | 2:e05f61e0fa4b | 29 | } |