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:38c4995b3635, 2018-12-18 (annotated)
- Committer:
- cakejohnn
- Date:
- Tue Dec 18 21:18:40 2018 +0000
- Revision:
- 0:38c4995b3635
nm./
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| cakejohnn | 0:38c4995b3635 | 1 | #include "mbed.h" |
| cakejohnn | 0:38c4995b3635 | 2 | |
| cakejohnn | 0:38c4995b3635 | 3 | Serial pc(D1,D0); // Configure LED1 pin as output |
| cakejohnn | 0:38c4995b3635 | 4 | DigitalIn button1(D2); |
| cakejohnn | 0:38c4995b3635 | 5 | DigitalIn button2(D3); // Configure P1_14 pin as input |
| cakejohnn | 0:38c4995b3635 | 6 | |
| cakejohnn | 0:38c4995b3635 | 7 | int main() |
| cakejohnn | 0:38c4995b3635 | 8 | { |
| cakejohnn | 0:38c4995b3635 | 9 | while(1) { |
| cakejohnn | 0:38c4995b3635 | 10 | if(button1 == 1){pc.printf("1HIGH\n");} |
| cakejohnn | 0:38c4995b3635 | 11 | if(button2 == 0){pc.printf("1LOW\n");} |
| cakejohnn | 0:38c4995b3635 | 12 | if(button2 == 1){pc.printf("2HIGH\n");} |
| cakejohnn | 0:38c4995b3635 | 13 | if(button2 == 0){pc.printf("2LOW\n");} /* read the state of input pin P1_14 and write it to output port pin LED1*/ |
| cakejohnn | 0:38c4995b3635 | 14 | } |
| cakejohnn | 0:38c4995b3635 | 15 | } |