buzzer, switch, led for the CORE-1000

Dependencies:   mbed

Committer:
odb
Date:
Fri Feb 03 07:48:22 2017 +0000
Revision:
4:831a73794478
Parent:
2:b60cb847489c
CORE-1000 First

Who changed what in which revision?

UserRevisionLine numberNew contents of line
screamer 0:005629fe3609 1 #include "mbed.h"
screamer 0:005629fe3609 2
odb 4:831a73794478 3 DigitalOut mybuzzer(PC_4);
odb 4:831a73794478 4 //DigitalOut myled [4] = { PH_0, PH_1, PC_2, PC_3};
odb 4:831a73794478 5 DigitalOut myled [4] = { PC_9, PB_2, PC_2, PC_3};
odb 4:831a73794478 6 DigitalIn enable[4] = {PC_10,PC_11, PC_12, PA_13 };
screamer 0:005629fe3609 7 int main() {
screamer 0:005629fe3609 8 while(1) {
odb 4:831a73794478 9 mybuzzer = 1; // LED is ON
bcostm 2:b60cb847489c 10 wait(0.2); // 200 ms
odb 4:831a73794478 11 mybuzzer = 0; // LED is OFF
bcostm 2:b60cb847489c 12 wait(1.0); // 1 sec
odb 4:831a73794478 13 for(int i = 0; i < 4 ; i++)
odb 4:831a73794478 14 {
odb 4:831a73794478 15 if(!(enable[i]))
odb 4:831a73794478 16 {
odb 4:831a73794478 17 myled[i] = 1;
odb 4:831a73794478 18 wait(0.25);
odb 4:831a73794478 19 }
odb 4:831a73794478 20 else myled[i] = 0;
odb 4:831a73794478 21 }
screamer 0:005629fe3609 22 }
screamer 0:005629fe3609 23 }