Blinky LED test for ST Nucleo boards

Dependencies:   mbed

Committer:
Wiegerinck
Date:
Wed Mar 28 11:32:58 2018 +0000
Revision:
7:4f8de47a9641
Parent:
2:b60cb847489c
Teste_1

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:005629fe3609 1 #include "mbed.h"
screamer 0:005629fe3609 2
screamer 0:005629fe3609 3 DigitalOut myled(LED1);
Wiegerinck 7:4f8de47a9641 4 DigitalOut T1(PB_3);
Wiegerinck 7:4f8de47a9641 5 DigitalOut T2(PB_4);
Wiegerinck 7:4f8de47a9641 6 DigitalOut T3(PB_5);
Wiegerinck 7:4f8de47a9641 7 DigitalOut T4(PB_10);
Wiegerinck 7:4f8de47a9641 8
Wiegerinck 7:4f8de47a9641 9 int val = 0;
screamer 0:005629fe3609 10
screamer 0:005629fe3609 11 int main() {
screamer 0:005629fe3609 12 while(1) {
Wiegerinck 7:4f8de47a9641 13 while(val <= 50) {
Wiegerinck 7:4f8de47a9641 14 myled = 1; // LED is ON
Wiegerinck 7:4f8de47a9641 15 T1 = 1;
Wiegerinck 7:4f8de47a9641 16 T2 = 0;
Wiegerinck 7:4f8de47a9641 17 T3 = 0;
Wiegerinck 7:4f8de47a9641 18 T4 = 0;
Wiegerinck 7:4f8de47a9641 19 wait(0.01); // 200 ms
Wiegerinck 7:4f8de47a9641 20 myled = 0; // LED is OFF
Wiegerinck 7:4f8de47a9641 21 T1 = 0;
Wiegerinck 7:4f8de47a9641 22 T2 = 1;
Wiegerinck 7:4f8de47a9641 23 T3 = 0;
Wiegerinck 7:4f8de47a9641 24 T4 = 0;
Wiegerinck 7:4f8de47a9641 25 wait(0.01); // 1 sec
Wiegerinck 7:4f8de47a9641 26 T1 = 0;
Wiegerinck 7:4f8de47a9641 27 T2 = 0;
Wiegerinck 7:4f8de47a9641 28 T3 = 1;
Wiegerinck 7:4f8de47a9641 29 T4 = 0;
Wiegerinck 7:4f8de47a9641 30 wait(0.01);
Wiegerinck 7:4f8de47a9641 31 T1 = 0;
Wiegerinck 7:4f8de47a9641 32 T2 = 0;
Wiegerinck 7:4f8de47a9641 33 T3 = 0;
Wiegerinck 7:4f8de47a9641 34 T4 = 1;
Wiegerinck 7:4f8de47a9641 35 wait(0.01);
Wiegerinck 7:4f8de47a9641 36 val = val + 1;
Wiegerinck 7:4f8de47a9641 37 }
Wiegerinck 7:4f8de47a9641 38 while(val >= 0) {
Wiegerinck 7:4f8de47a9641 39 myled = 1; // LED is ON
Wiegerinck 7:4f8de47a9641 40 T1 = 0;
Wiegerinck 7:4f8de47a9641 41 T2 = 0;
Wiegerinck 7:4f8de47a9641 42 T3 = 1;
Wiegerinck 7:4f8de47a9641 43 T4 = 0;
Wiegerinck 7:4f8de47a9641 44 wait(0.01); // 200 ms
Wiegerinck 7:4f8de47a9641 45 myled = 0; // LED is OFF
Wiegerinck 7:4f8de47a9641 46 T1 = 0;
Wiegerinck 7:4f8de47a9641 47 T2 = 1;
Wiegerinck 7:4f8de47a9641 48 T3 = 0;
Wiegerinck 7:4f8de47a9641 49 T4 = 0;
Wiegerinck 7:4f8de47a9641 50 wait(0.01); // 1 sec
Wiegerinck 7:4f8de47a9641 51 T1 = 1;
Wiegerinck 7:4f8de47a9641 52 T2 = 0;
Wiegerinck 7:4f8de47a9641 53 T3 = 0;
Wiegerinck 7:4f8de47a9641 54 T4 = 0;
Wiegerinck 7:4f8de47a9641 55 wait(0.01);
Wiegerinck 7:4f8de47a9641 56 T1 = 0;
Wiegerinck 7:4f8de47a9641 57 T2 = 0;
Wiegerinck 7:4f8de47a9641 58 T3 = 0;
Wiegerinck 7:4f8de47a9641 59 T4 = 1;
Wiegerinck 7:4f8de47a9641 60 wait(0.01);
Wiegerinck 7:4f8de47a9641 61 val = val - 1;
Wiegerinck 7:4f8de47a9641 62 }
screamer 0:005629fe3609 63 }
screamer 0:005629fe3609 64 }