Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: TCS3472_I2C mbed
Diff: main.cpp
- Revision:
- 0:ed1ae1bcbe64
diff -r 000000000000 -r ed1ae1bcbe64 main.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp Mon May 11 19:05:36 2015 +0000
@@ -0,0 +1,38 @@
+#include "mbed.h"
+#include "TCS3472_I2C.h" //actually an hpp
+#define switch_addr 0xE0
+
+
+
+TCS3472_I2C Sensor1 (P0_22, P0_20);
+
+I2C i2c( P0_22, P0_20);
+
+
+
+
+int main()
+{
+ i2c.frequency(400000);
+ char cmd [1];
+ int RGBC[4];
+
+Sensor1.enablePowerAndRGBC();
+Sensor1.setIntegrationTime(100);
+Sensor1.setRGBCGain(1);
+Sensor1.enableWait();
+
+while(1){
+ cmd[0]=0x01;
+ i2c.write(switch_addr,cmd,1);
+ Sensor1.getAllColors(RGBC);
+ Sensor1.getAllColors(RGBC);
+ printf("red %d green %d blue %d clear %d\r\n",RGBC[0],RGBC[1],RGBC[2],RGBC[3]);
+
+ cmd[0]=0x02;
+ i2c.write(switch_addr,cmd,1);
+ Sensor1.getAllColors(RGBC);
+ Sensor1.getAllColors(RGBC);
+ printf("red %d green %d blue %d clear %d\r\n",RGBC[0],RGBC[1],RGBC[2],RGBC[3]);
+ }
+}