Test

Dependencies:   mbed-src

Committer:
ouleiqi
Date:
Fri Mar 22 07:14:00 2019 +0000
Revision:
0:f92fadf3c5a3
Test

Who changed what in which revision?

UserRevisionLine numberNew contents of line
ouleiqi 0:f92fadf3c5a3 1 #include "mbed.h"
ouleiqi 0:f92fadf3c5a3 2
ouleiqi 0:f92fadf3c5a3 3 Serial pc(PA_2, PA_3); // TX, RX
ouleiqi 0:f92fadf3c5a3 4 DigitalOut myled(PC_13); // on-board LED
ouleiqi 0:f92fadf3c5a3 5
ouleiqi 0:f92fadf3c5a3 6 int main()
ouleiqi 0:f92fadf3c5a3 7 {
ouleiqi 0:f92fadf3c5a3 8 while(1) {
ouleiqi 0:f92fadf3c5a3 9 // The on-board LED is connected via a resistor to +3.3V (not to GND).
ouleiqi 0:f92fadf3c5a3 10 // So the LED is active on 0
ouleiqi 0:f92fadf3c5a3 11 myled = 0; // turn the LED on
ouleiqi 0:f92fadf3c5a3 12 wait_ms(200); // wait 200 millisecond
ouleiqi 0:f92fadf3c5a3 13 myled = 1; // turn the LED off
ouleiqi 0:f92fadf3c5a3 14 pc.printf("Blink\r\n");
ouleiqi 0:f92fadf3c5a3 15 wait_ms(1000); // wait 1000 millisecond
ouleiqi 0:f92fadf3c5a3 16 }
ouleiqi 0:f92fadf3c5a3 17 }