Full application

Dependencies:   mbed libTCS34725 lib_LoRaWAN

Revision:
4:5596b326cd34
Parent:
3:67413b100ac3
Child:
5:c64f313ca878
diff -r 67413b100ac3 -r 5596b326cd34 main.cpp
--- a/main.cpp	Wed Jan 16 15:24:23 2019 +0000
+++ b/main.cpp	Wed Jan 16 15:30:36 2019 +0000
@@ -3,8 +3,11 @@
 #include "TCS34725.h"
 
 InterruptIn button1(PG_0);
+InterruptIn button2(PG_1);
 Serial pc(USBTX, USBRX);
 DigitalOut ledRED(PD_14);
+DigitalOut ledGreen(PB_0);
+DigitalOut ledBlue(PD_15);
 //Sht31 Sht31(PB_9,PB_8);
 TCS34725 colorSens(PB_9,PB_8);
 
@@ -21,6 +24,18 @@
     delay = 0.5; // 500 ms
 }
 
+void BTN2pressed()
+{
+    //Andere code nodig
+    delay = 0.1; // 100 ms
+}
+
+void BTN2released()
+{
+    //andere code nodig
+    delay = 0.5; // 500 ms
+}
+
 int main()
 {
     uint16_t r,g,b,c;
@@ -29,6 +44,10 @@
     button1.fall(&BTN1pressed);
     button1.rise(&BTN1released);
     
+    // Assign functions to button2 
+    button2.fall(&BTN2pressed);
+    button2.rise(&BTN2released);
+    
     //serial communication
     pc.baud(115200);
     pc.printf("Welcome at University of Antwerp #STEM2019 \r\n");