digital input example of CORE-1000

Dependencies:   mbed

main.cpp

Committer:
odb
Date:
2019-01-09
Revision:
2:fe6a81c5e6b8
Parent:
1:4a3198da4fe1

File content as of revision 2:fe6a81c5e6b8:

#include "mbed.h"


//DigitalOut mybuzzer(PC_4);
//PwmOut mypwmR(PB_5);
//PwmOut mypwmG(PB_3);
//PwmOut mypwmB(PA_10);
DigitalOut myled[4] = { PC_9, PB_2, PC_2, PC_3};

DigitalIn Sensor_DIN(PA_6);
Serial pc(USBTX, USBRX); // tx, rx
int main() {
    pc.baud(115200);
    pc.printf("\n Sensor Digital InPut example\n");
    while(1) {
        if (Sensor_DIN == 0){
            myled[0] = 1;
            pc.printf("sensor detected \n\r");
        }
        else{
            myled[0] = 0;
        }
    }
}