Full application

Dependencies:   mbed libTCS34725 lib_LoRaWAN

Committer:
dsubotic
Date:
Wed Jan 16 13:40:11 2019 +0000
Revision:
2:7040e447d0df
Parent:
1:c3a839871165
Child:
3:67413b100ac3
Added Library temp&Hum + serial communication

Who changed what in which revision?

UserRevisionLine numberNew contents of line
dsubotic 0:1cadcdcf4521 1 #include "mbed.h"
dsubotic 0:1cadcdcf4521 2
dsubotic 2:7040e447d0df 3 InterruptIn button1(PG_0);
dsubotic 2:7040e447d0df 4 Serial pc(USBTX, USBRX);
dsubotic 2:7040e447d0df 5 DigitalOut ledRED(PD_14);
dsubotic 0:1cadcdcf4521 6
dsubotic 0:1cadcdcf4521 7 double delay = 0.5; // 500 ms
dsubotic 0:1cadcdcf4521 8
dsubotic 2:7040e447d0df 9 void BTN1pressed()
dsubotic 0:1cadcdcf4521 10 {
dsubotic 0:1cadcdcf4521 11 delay = 0.1; // 100 ms
dsubotic 0:1cadcdcf4521 12 }
dsubotic 0:1cadcdcf4521 13
dsubotic 2:7040e447d0df 14 void BTN1released()
dsubotic 0:1cadcdcf4521 15 {
dsubotic 0:1cadcdcf4521 16 delay = 0.5; // 500 ms
dsubotic 0:1cadcdcf4521 17 }
dsubotic 0:1cadcdcf4521 18
dsubotic 0:1cadcdcf4521 19 int main()
dsubotic 0:1cadcdcf4521 20 {
dsubotic 2:7040e447d0df 21 // Assign functions to button1
dsubotic 2:7040e447d0df 22 button1.fall(&BTN1pressed);
dsubotic 2:7040e447d0df 23 button1.rise(&BTN1released);
dsubotic 2:7040e447d0df 24
dsubotic 2:7040e447d0df 25 //serial communication
dsubotic 2:7040e447d0df 26 pc.baud(115200);
dsubotic 2:7040e447d0df 27 pc.printf("Welcome at University of Antwerp #STEM2019 \r\n");
dsubotic 0:1cadcdcf4521 28
dsubotic 0:1cadcdcf4521 29 while (1) {
dsubotic 2:7040e447d0df 30 ledRED = !ledRED;
dsubotic 0:1cadcdcf4521 31 wait(delay);
dsubotic 0:1cadcdcf4521 32 }
dsubotic 0:1cadcdcf4521 33 }