Seeed Studio Grove Sensors Example

Dependencies:   mbed DHT DigitDisplay

Fork of STM32_Read_Sensors_Example by AT&T Developer Summit Hackathon 2016

Revision:
6:d25c6da3f0b6
Parent:
5:41a15c0653e8
Child:
7:d52c3793a04a
--- a/main.cpp	Wed Dec 17 23:56:26 2014 +0000
+++ b/main.cpp	Thu Dec 18 17:53:04 2014 +0000
@@ -1,6 +1,7 @@
 #include "mbed.h"
 #include "ADXL345_I2C.h"
 #include "DHT.h"
+#include "DigitDisplay.h"
 
 
 //#define LED                 // Grove LED
@@ -9,7 +10,8 @@
 //#define WATER_SENSOR        // Grove Water Sensor
 //#define GAS_SENSOR          // SEN90512P Grove - Gas Sensor(MQ2)
 //#define TEMP_SENSOR         // Grove Temperature Sensor using TTC03 Thermistor 
-#define TEMP_HUMID_SENSOR   // Grove Temp/Humidity Sensor (DHT11)
+//#define TEMP_HUMID_SENSOR   // Grove Temp/Humidity Sensor (DHT11)
+#define DIGIT_DISPLAY       // Grove 4-digit display
 
  
 AnalogIn temp_sensor(A0);     
@@ -19,6 +21,7 @@
 DigitalOut my_led(D7);
 ADXL345_I2C accelerometer(D14, D15);
 DHT temp_humid_sensor(A0, DHT11);  // See DHT.h for other supported sensor types
+DigitDisplay DigitalDisplay(D2, D3); // For connection to port D2 on Grove shield
 
 int main() {
     
@@ -144,5 +147,20 @@
         wait(1);
 #endif
 
+#ifdef DIGIT_DISPLAY
+        static int16_t message[] = {0xF, 0xE, 0xE, 0xD, 0xC, 0x0, 0xD, 0xE};
+        static int ArraySize = sizeof(message)/sizeof(message[0]);
+        static int MessageStart = 0;
+        DigitalDisplay.on();
+
+        for (int position = 0; position <= 3; position++)
+        {
+            DigitalDisplay.write(position, message[(position + MessageStart) % ArraySize]);
+        }
+        MessageStart++;
+
+        wait(.3);
+#endif
+
     }
 }