ST Americas mbed Team / Mbed 2 deprecated SeeedStudio_Grove_Sensors_Demo

Dependencies:   mbed DHT DigitDisplay

Fork of STM32_Read_Sensors_Example by AT&T Developer Summit Hackathon 2016

Files at this revision

API Documentation at this revision

Comitter:
dangriffin
Date:
Thu Dec 18 17:53:04 2014 +0000
Parent:
5:41a15c0653e8
Child:
7:d52c3793a04a
Commit message:
Added support for Grove 4-digit display

Changed in this revision

DigitDisplay.lib Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/DigitDisplay.lib	Thu Dec 18 17:53:04 2014 +0000
@@ -0,0 +1,1 @@
+http://developer.mbed.org/teams/Seeed/code/DigitDisplay/#d3173c8bfd48
--- 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
+
     }
 }