TCS3200 color sensor

Dependencies:   TCS3200 mbed

Fork of my_example_TCS3200 by liang brain

Revision:
1:1550b3529045
Parent:
0:2121a7904d2e
--- a/main.cpp	Mon Oct 09 10:44:30 2017 +0000
+++ b/main.cpp	Wed Mar 21 05:01:18 2018 +0000
@@ -10,23 +10,21 @@
 #include <cstdarg>
 
 #include "mbed.h"
+#include "TextLCD.h"
 #include "color.h"
 
-// DEBUG USB serial
-Serial ser2usb(USBTX, USBRX);
-int ser_baud = 9600;
-#define LOG(format, ...) do{\                                                   //定义了一个调试的宏,C语言语法
-    ser2usb.printf(format "\r\n", ##__VA_ARGS__);\
-}while(0)
+int main() {
+    TextLCD lcd(PC_13, PC_14, PC_15, PA_0, PA_1, PB_4, TextLCD::LCD20x4); // rs, e, d4-d7, model
 
-int main() {
     // S0,S1,S2,S3,OUT
-    ColorSensor color(PA_0, PA_1, PA_4, PB_0, PC_1);                            //用5个GPIO管脚
+    ColorSensor color(PB_11, PA_12, PB_1, PB_10, PB_9);                            //用5个GPIO管脚
+
     while(1) {
         int red = color.getRed();
         int green = color.getGreen();
         int blue = color.getBlue();
-        LOG("Color: R:%d G:%d B:%d", red, green, blue);
+        lcd.cls();
+        lcd.printf("Color:\nR:%d G:%d B:%d", red, green, blue);
         wait(1);
     }
 }
\ No newline at end of file