1

Dependencies:   mbed

Committer:
skycc6
Date:
Sun Sep 16 10:06:27 2018 +0000
Revision:
0:af1ec5a8b7e5
pwm chuang kou

Who changed what in which revision?

UserRevisionLine numberNew contents of line
skycc6 0:af1ec5a8b7e5 1 // Toggle the blinking led after 5 seconds
skycc6 0:af1ec5a8b7e5 2
skycc6 0:af1ec5a8b7e5 3 #include "mbed.h"
skycc6 0:af1ec5a8b7e5 4 #define LED1 PA_2
skycc6 0:af1ec5a8b7e5 5 #define LED2 PA_3
skycc6 0:af1ec5a8b7e5 6 Ticker timer;
skycc6 0:af1ec5a8b7e5 7 DigitalOut led1(LED1);
skycc6 0:af1ec5a8b7e5 8 DigitalOut led2(LED2);
skycc6 0:af1ec5a8b7e5 9
skycc6 0:af1ec5a8b7e5 10 int flip = 0;
skycc6 0:af1ec5a8b7e5 11 Serial pc(PA_9, PA_10,9600);
skycc6 0:af1ec5a8b7e5 12 void attime() {
skycc6 0:af1ec5a8b7e5 13 flip = !flip;
skycc6 0:af1ec5a8b7e5 14 }
skycc6 0:af1ec5a8b7e5 15
skycc6 0:af1ec5a8b7e5 16 int main() {
skycc6 0:af1ec5a8b7e5 17 timer.attach(&attime, 10);
skycc6 0:af1ec5a8b7e5 18 while(1) {
skycc6 0:af1ec5a8b7e5 19 pc.printf("Hello World\n");
skycc6 0:af1ec5a8b7e5 20 led1 = flip;
skycc6 0:af1ec5a8b7e5 21 led2 = !flip;
skycc6 0:af1ec5a8b7e5 22 }
skycc6 0:af1ec5a8b7e5 23 }