Full application

Dependencies:   mbed libTCS34725 lib_LoRaWAN

main.cpp

Committer:
dsubotic
Date:
2019-01-16
Revision:
2:7040e447d0df
Parent:
1:c3a839871165
Child:
3:67413b100ac3

File content as of revision 2:7040e447d0df:

#include "mbed.h"

InterruptIn button1(PG_0);
Serial pc(USBTX, USBRX);
DigitalOut ledRED(PD_14);

double delay = 0.5; // 500 ms

void BTN1pressed()
{
    delay = 0.1; // 100 ms
}

void BTN1released()
{
    delay = 0.5; // 500 ms
}

int main()
{
    // Assign functions to button1 
    button1.fall(&BTN1pressed);
    button1.rise(&BTN1released);
    
    //serial communication
    pc.baud(115200);
    pc.printf("Welcome at University of Antwerp #STEM2019 \r\n");

    while (1) {
        ledRED = !ledRED;
        wait(delay);
    }
}