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@0:38b5112b5f3a, 2018-05-11 (annotated)
- Committer:
- ctasdemir
- Date:
- Fri May 11 04:58:07 2018 +0000
- Revision:
- 0:38b5112b5f3a
buton ?rne?i
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| ctasdemir | 0:38b5112b5f3a | 1 | #include "mbed.h" |
| ctasdemir | 0:38b5112b5f3a | 2 | /* |
| ctasdemir | 0:38b5112b5f3a | 3 | DigitalIn mybutton(USER_BUTTON); |
| ctasdemir | 0:38b5112b5f3a | 4 | DigitalOut myled(LED1); |
| ctasdemir | 0:38b5112b5f3a | 5 | */ |
| ctasdemir | 0:38b5112b5f3a | 6 | DigitalIn mybutton(PC_13); |
| ctasdemir | 0:38b5112b5f3a | 7 | DigitalOut myled(PA_5); |
| ctasdemir | 0:38b5112b5f3a | 8 | |
| ctasdemir | 0:38b5112b5f3a | 9 | |
| ctasdemir | 0:38b5112b5f3a | 10 | int main() { |
| ctasdemir | 0:38b5112b5f3a | 11 | while(1) { |
| ctasdemir | 0:38b5112b5f3a | 12 | if (mybutton.read() == 0) { // Button is pressed |
| ctasdemir | 0:38b5112b5f3a | 13 | myled = !myled; // Toggle the LED state |
| ctasdemir | 0:38b5112b5f3a | 14 | wait(0.2); // 200 ms |
| ctasdemir | 0:38b5112b5f3a | 15 | } |
| ctasdemir | 0:38b5112b5f3a | 16 | } |
| ctasdemir | 0:38b5112b5f3a | 17 | } |
| ctasdemir | 0:38b5112b5f3a | 18 |