Sutro / Mbed 2 deprecated sutroi2cswitcher

Dependencies:   TCS3472_I2C mbed

Files at this revision

API Documentation at this revision

Comitter:
averybolt
Date:
Mon May 11 19:05:36 2015 +0000
Commit message:
i2c switcher test

Changed in this revision

TCS3472_I2C.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/TCS3472_I2C.lib	Mon May 11 19:05:36 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/karlmaxwell67/code/TCS3472_I2C/#6d5bb4ad7d6e
--- /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]);
+    }    
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Mon May 11 19:05:36 2015 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/8ab26030e058
\ No newline at end of file