Sutro / Mbed 2 deprecated sutroi2cswitcher

Dependencies:   TCS3472_I2C mbed

Revision:
0:ed1ae1bcbe64
--- /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]);
+    }    
+}