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
Blinking.cpp@1:9929cc08730b, 2019-11-15 (annotated)
- Committer:
- pinofal
- Date:
- Fri Nov 15 14:00:57 2019 +0000
- Revision:
- 1:9929cc08730b
Primo programma
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| pinofal | 1:9929cc08730b | 1 | #include "mbed.h" |
| pinofal | 1:9929cc08730b | 2 | // genera un oggetto serial collegato al PC |
| pinofal | 1:9929cc08730b | 3 | Serial pc(USBTX, USBRX); |
| pinofal | 1:9929cc08730b | 4 | |
| pinofal | 1:9929cc08730b | 5 | // genera un oggetto DigitalOut collegato al Led |
| pinofal | 1:9929cc08730b | 6 | DigitalIn myButton(USER_BUTTON); |
| pinofal | 1:9929cc08730b | 7 | DigitalOut myLed(LED1); |
| pinofal | 1:9929cc08730b | 8 | |
| pinofal | 1:9929cc08730b | 9 | //DigitalIn myButton(PA_0); // verde |
| pinofal | 1:9929cc08730b | 10 | int main() |
| pinofal | 1:9929cc08730b | 11 | { |
| pinofal | 1:9929cc08730b | 12 | // configura velocità della comunicazione seriale su USB-VirtualCom e invia messaggio di benvenuto |
| pinofal | 1:9929cc08730b | 13 | pc.baud(921600); //921600 bps |
| pinofal | 1:9929cc08730b | 14 | |
| pinofal | 1:9929cc08730b | 15 | while(true) |
| pinofal | 1:9929cc08730b | 16 | { |
| pinofal | 1:9929cc08730b | 17 | myLed = 0; |
| pinofal | 1:9929cc08730b | 18 | wait(1); |
| pinofal | 1:9929cc08730b | 19 | myLed = 1; |
| pinofal | 1:9929cc08730b | 20 | |
| pinofal | 1:9929cc08730b | 21 | if(myButton==0) |
| pinofal | 1:9929cc08730b | 22 | { |
| pinofal | 1:9929cc08730b | 23 | pc.printf("IN = 0\r\n"); |
| pinofal | 1:9929cc08730b | 24 | myLed = 1; |
| pinofal | 1:9929cc08730b | 25 | } |
| pinofal | 1:9929cc08730b | 26 | else |
| pinofal | 1:9929cc08730b | 27 | { |
| pinofal | 1:9929cc08730b | 28 | pc.printf("IN = 1\r\n"); |
| pinofal | 1:9929cc08730b | 29 | myLed = 0; |
| pinofal | 1:9929cc08730b | 30 | } |
| pinofal | 1:9929cc08730b | 31 | } |
| pinofal | 1:9929cc08730b | 32 | } |