fork of seeed studio 4-digit display for st nucleo board

Dependencies:   Data_Clock_Pair Seeed_Chainable_LED Seeed_Four_Digit_Disp Seeed_IR_Temp_Sensor Seeed_Led_Bar

Fork of Seeed_Grove_4_Digit_Display_Clock by Seeed

Revision:
15:abda719ba6e6
Parent:
12:a16d86fac131
Child:
17:71c14845db51
--- a/main.cpp	Thu Apr 27 16:10:16 2017 -0600
+++ b/main.cpp	Thu May 18 10:47:08 2017 -0600
@@ -6,21 +6,27 @@
 #include "SeeedFourDigitDisp.h"
 #include "SeeedQTouch.h"
 #include "SeeedChainableLED.h"
+#include "SeeedIRTempSensor.h"
+
+namespace  {
 
 Serial pc(SERIAL_TX, SERIAL_RX);
 DigitalOut led(PF_12);
 AnalogIn knob(PA_3);
 
-void led_thread(void const* args) {
+void led_thread() {
     while(1) {
         led = !led;
         Thread::wait(1000);
     }
 }
+} // namespace
 
 int main() {
     pc.printf("\n\nstarting algorithm\n\n");
-    DataClockPair chainablePins, rgbPins, qTouchPins, dispPins, ledBarPins;
+    DataClockPair chainablePins, rgbPins, qTouchPins, dispPins, ledBarPins, surrDispPins;
+    surrDispPins.dataPin = PG_0;
+    surrDispPins.clockPin = PG_1;
     ledBarPins.dataPin = PE_9;
     ledBarPins.clockPin = PF_13;
     dispPins.dataPin = PE_13;
@@ -33,11 +39,13 @@
     chainablePins.dataPin = PE_11;
     SeeedLedBar ledBar(ledBarPins);
     SeeedFourDigitDisp disp(dispPins);
+    SeeedFourDigitDisp surrDisp(surrDispPins);
     SeeedQTouch qTouch(qTouchPins);
     SeeedChainableLED led_chain(chainablePins);
     SeeedChainableLED rgb_led(rgbPins);
 
-    Thread blinky(led_thread);
+    Thread blinky;
+    blinky.start(callback(led_thread));
 
     disp.set_digit(0,0);
     int knob_led_bar[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
@@ -48,7 +56,8 @@
     rgb_led.set_color_rgb(50,200,10);
     while (1) {
         qTouch.key_touch(&pc);
-        float led_frac = knob.read();
+        surrDisp.set_integer(floor(IRTempSensor::measureObjectTemp(PA_3, PC_0)));
+        auto led_frac = knob.read();
         int led_percent = floor(led_frac * 100);
         int tens = floor(led_frac * 10);
         int ones = led_percent % 10;
@@ -58,9 +67,12 @@
         knob_led_bar[tens] = ones * 0xf;
         for (int i = ++tens; i < 10; ++i) knob_led_bar[i] = 0x00;
         ledBar.ten_set(knob_led_bar);
-        disp.set_integer(led_percent);
+        disp.set_integer(floor(IRTempSensor::measuresureTemp(PA_3)));
+        /* disp.set_integer(led_percent); */
         int eightBitInput = led_frac * 255;
         led_chain.set_color_rgb(eightBitInput, eightBitInput, eightBitInput);
-        Thread::wait(2000);
+        rgb_led.set_color_rgb(50,eightBitInput,10);
+        Thread::wait(1000);
     }
+    return 1;
 }