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
Diff: LED-Button-Polling.cpp
- Revision:
- 2:8cd95bea99dc
- Parent:
- 1:832dfb4ba1af
- Child:
- 3:042d47e3c101
--- a/LED-Button-Polling.cpp Mon May 07 07:11:49 2018 +0000
+++ b/LED-Button-Polling.cpp Sun Jul 01 11:30:52 2018 +0000
@@ -13,25 +13,28 @@
/********/
int main()
{
- // imposta velocità della comunicazione con il PC
- pc.baud(921600);
+ // imposta velocità della comunicazione con il PC
+ pc.baud(921600);
+
+ // messaggio di benvenuto
+ pc.printf("\r\nHallo Amaldi Students - Exercise 3 \r\n");
- //imposta il funzionamento del pulsante come "PullDown": Aperto = '0'. L'altra modalità di funzinamento è PullUp
- myButton.mode(PullDown);
+ //imposta il funzionamento del pulsante come "PullDown": Aperto = '0'. L'altra modalità di funzinamento è PullUp
+ myButton.mode(PullDown);
- // POLLING: replica sul LED myLED lo stato del pulsante myButton
- while(true)
- {
- if (myButton == 1)
- {
- // Button is pressed
- myLed = 1; // Accendi LED
+ // POLLING: replica sul LED myLED lo stato del pulsante myButton
+ while(true)
+ {
+ if (myButton == 1)
+ {
+ // Button is pressed
+ myLed = 1; // Accendi LED
+ }
+ else
+ {
+ // Button i released
+ myLed = 0; // Spegni LED
+ }
}
- else
- {
- // Button i released
- myLed = 0; // Spegni LED
- }
- }
}
\ No newline at end of file