qw

Dependencies:   TCS3200 mbed

Files at this revision

API Documentation at this revision

Comitter:
brainliang
Date:
Mon Oct 09 10:44:30 2017 +0000
Commit message:
ii

Changed in this revision

TCS3200.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
mbed.bld Show annotated file Show diff for this revision Revisions of this file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TCS3200.lib	Mon Oct 09 10:44:30 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/wingblank/code/TCS3200/#9edf5a7e29e6
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Mon Oct 09 10:44:30 2017 +0000
@@ -0,0 +1,32 @@
+/*-----------------------------------------------------
+ File Name : main.cpp
+ Purpose : For tcs3200 sensor
+ Creation Date : 24-06-2017
+ Last Modified :
+ Created By : Jeasine Ma [jeasinema[at]gmail[dot]com]
+-----------------------------------------------------*/
+#include <cstdio>
+#include <cstring>
+#include <cstdarg>
+
+#include "mbed.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() {
+    // S0,S1,S2,S3,OUT
+    ColorSensor color(PA_0, PA_1, PA_4, PB_0, PC_1);                            //用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);
+        wait(1);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon Oct 09 10:44:30 2017 +0000
@@ -0,0 +1,1 @@
+https://mbed.org/users/mbed_official/code/mbed/builds/64910690c574
\ No newline at end of file