dddddddddddddd

Dependencies:   mbed TCS3472_I2C MCP23017 WattBob_TextLCD

Files at this revision

API Documentation at this revision

Comitter:
maazshaikh
Date:
Tue Mar 03 19:25:29 2020 +0000
Commit message:
dsd

Changed in this revision

MCP23017.lib Show annotated file Show diff for this revision Revisions of this file
TCS3472_I2C.lib Show annotated file Show diff for this revision Revisions of this file
WattBob_TextLCD.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/MCP23017.lib	Tue Mar 03 19:25:29 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/teams/aconno-dev-team/code/MCP23017/#1834cdf54c8f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TCS3472_I2C.lib	Tue Mar 03 19:25:29 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/karlmaxwell67/code/TCS3472_I2C/#6d5bb4ad7d6e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/WattBob_TextLCD.lib	Tue Mar 03 19:25:29 2020 +0000
@@ -0,0 +1,1 @@
+https://os.mbed.com/users/jimherd/code/WattBob_TextLCD/#3b26cd028e85
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Tue Mar 03 19:25:29 2020 +0000
@@ -0,0 +1,51 @@
+#include "mbed.h"
+#include "MCP23017.h"
+#include "WattBob_TextLCD.h"
+#include "TCS3472_I2C.h"
+
+DigitalOut myled(LED1);
+
+#define     BACK_LIGHT_ON(INTERFACE)    INTERFACE->write_bit(1,BL_BIT)
+#define     BACK_LIGHT_OFF(INTERFACE)   INTERFACE->write_bit(0,BL_BIT)
+
+MCP23017            *par_port;
+WattBob_TextLCD     *lcd;
+
+TCS3472_I2C rgb_sensor(p22, p21);
+
+Serial      pc(USBTX, USBRX);  // default 9600 baud
+
+int main() {
+    
+int rgb_readings[4];
+    
+    par_port = new MCP23017(p9, p10, 0x40);
+    par_port->config(0x0F00, 0x0F00, 0x0F00);           // configure MCP23017 chip on WattBob
+
+    lcd = new WattBob_TextLCD(par_port);
+
+    BACK_LIGHT_ON(par_port);
+    lcd->printf("Colour sensor \n");
+    
+    rgb_sensor.enablePowerAndRGBC();
+    rgb_sensor.setIntegrationTime(100);
+    
+    myled = 0;
+    
+    for (int i = 0 ; i < 10 ; i++) {
+        rgb_sensor.getAllColors(rgb_readings);
+        pc.printf("red  %d,  green: %d,  blue: %d,  clear: %d\r\n",rgb_readings[0], rgb_readings[1], rgb_readings[2],rgb_readings[3]);
+        lcd->cls(); lcd->locate(0,0);
+        lcd->printf("clear: %d",rgb_readings[0], rgb_readings[1], rgb_readings[2],rgb_readings[3]);
+        wait(2);
+        lcd->cls(); lcd->locate(0,0);
+        lcd->printf("red: %d",rgb_readings[1]);
+        wait(2);
+        lcd->cls(); lcd->locate(0,0);
+        lcd->printf("green:  %d",rgb_readings[2]);
+        wait(2);
+        lcd->cls(); lcd->locate(0,0);
+        lcd->printf("blue: %d",rgb_readings[3]);
+        wait(2);
+    }
+}
\ No newline at end of file
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mbed.bld	Tue Mar 03 19:25:29 2020 +0000
@@ -0,0 +1,1 @@
+http://mbed.org/users/mbed_official/code/mbed/builds/63bcd7ba4912