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@1:d5b594dc8056, 2016-11-10 (annotated)
- Committer:
- imihalj
- Date:
- Thu Nov 10 17:37:20 2016 +0000
- Revision:
- 1:d5b594dc8056
- Parent:
- 0:c32036656bb4
- Child:
- 2:549ed5b0a8d0
vjezba2
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
imihalj | 0:c32036656bb4 | 1 | #include "mbed.h" |
imihalj | 0:c32036656bb4 | 2 | DigitalOut redled(p5); |
imihalj | 0:c32036656bb4 | 3 | DigitalOut greenled(p6); |
imihalj | 1:d5b594dc8056 | 4 | DigitalIn sw1(p7); |
imihalj | 0:c32036656bb4 | 5 | int main() |
imihalj | 0:c32036656bb4 | 6 | { |
imihalj | 1:d5b594dc8056 | 7 | sw1.mode(PullUp); // Pull up internal resistor |
imihalj | 0:c32036656bb4 | 8 | while(1) { |
imihalj | 1:d5b594dc8056 | 9 | if (sw1==1) { |
imihalj | 1:d5b594dc8056 | 10 | greenled = 0; //green led is off |
imihalj | 1:d5b594dc8056 | 11 | redled = 1; // flash red led |
imihalj | 1:d5b594dc8056 | 12 | wait(0.2); |
imihalj | 1:d5b594dc8056 | 13 | redled = 0; |
imihalj | 1:d5b594dc8056 | 14 | wait(0.2); |
imihalj | 1:d5b594dc8056 | 15 | } else if (sw1==0) { |
imihalj | 1:d5b594dc8056 | 16 | redled = 0; //red led is off |
imihalj | 1:d5b594dc8056 | 17 | greenled = 1; // flash green led |
imihalj | 1:d5b594dc8056 | 18 | wait(0.2); |
imihalj | 1:d5b594dc8056 | 19 | greenled = 0; |
imihalj | 1:d5b594dc8056 | 20 | wait(0.2); |
imihalj | 1:d5b594dc8056 | 21 | } |
imihalj | 0:c32036656bb4 | 22 | } |
imihalj | 0:c32036656bb4 | 23 | } |