Blinky test

Fork of mbed-os-example-mbed5-blinky by mbed-os-examples

Committer:
fabio_gatti
Date:
Sun Aug 05 11:55:48 2018 +0200
Revision:
67:2342285b2af8
Parent:
66:5533276e17c4
Aggiunto set esplicito porta seriale

Who changed what in which revision?

UserRevisionLine numberNew contents of line
Jonathan Austin 0:2757d7abb7d9 1 #include "mbed.h"
Jonathan Austin 0:2757d7abb7d9 2
Jonathan Austin 0:2757d7abb7d9 3 DigitalOut led1(LED1);
fabio_gatti 66:5533276e17c4 4 Serial pc(USBTX, USBRX); // tx, rx comunicazione via USB
Jonathan Austin 0:2757d7abb7d9 5
Jonathan Austin 1:846c97078558 6 // main() runs in its own thread in the OS
Jonathan Austin 0:2757d7abb7d9 7 int main() {
Jonathan Austin 0:2757d7abb7d9 8 while (true) {
fabio_gatti 67:2342285b2af8 9 pc.baud(115200);
fabio_gatti 66:5533276e17c4 10 pc.printf("Inizio attesa ON\n");
fabio_gatti 66:5533276e17c4 11 wait(1.2); // attesa 1200 ms
fabio_gatti 66:5533276e17c4 12 pc.printf("Accensione LED\n");
fabio_gatti 66:5533276e17c4 13 led1 = 1; // led1 ON
fabio_gatti 66:5533276e17c4 14
fabio_gatti 66:5533276e17c4 15 pc.printf("Inizio attesa OFF\n");
fabio_gatti 66:5533276e17c4 16 wait(0.5); // attesa 500 ms
fabio_gatti 66:5533276e17c4 17 led1=0; // led1 OFF
fabio_gatti 66:5533276e17c4 18 pc.printf("Spegnimento LED\n");
Jonathan Austin 0:2757d7abb7d9 19 }
Jonathan Austin 0:2757d7abb7d9 20 }
Jonathan Austin 1:846c97078558 21