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: mbed
Fork of BeaconDemo_RobotCode by
Diff: PsiSwarm/colour.cpp
- Revision:
- 0:8a5497a2e366
- Child:
- 6:ff3c66f7372b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/PsiSwarm/colour.cpp Sat Oct 03 22:48:50 2015 +0000
@@ -0,0 +1,47 @@
+/* University of York Robotics Laboratory PsiSwarm Library: Colour Sensors Source File
+ *
+ * File: colour.cpp
+ *
+ * (C) Dr James Hilder, Dept. Electronics & Computer Science, University of York
+ *
+ * PsiSwarm Library Version: 0.2
+ *
+ * October 2015
+ *
+ */
+
+
+// Base colour sensor is a TCS34725
+// Top colour sensor (if fitted) is a TCS34721
+#include "psiswarm.h"
+
+
+void read_base_colour_sensor_values(int * store_array){
+
+}
+
+void set_base_colour_sensor_gain(char gain){
+
+}
+
+void set_base_colour_sensor_integration_time(char int_time){
+
+}
+
+void enable_base_colour_sensor(void){
+
+}
+
+char IF_check_base_colour_sensor(void){
+ //Reads the device ID flag of the colour sensor [0xB2]
+ //This should equal 0x44 for both TCS34721 (top) and TCS34725 (base) sensors
+ //Return a 1 if successful or a 0 otherwise
+ char return_value = 0;
+ char data[1] = {0x00};
+ char command[1] = {0xB2};
+ primary_i2c.write(BASE_COLOUR_ADDRESS, command, 1, false);
+ primary_i2c.read(BASE_COLOUR_ADDRESS, data, 1, false);
+ if(data[0] == 0x44) return_value = 1;
+ else debug("Invalid response from colour sensor:%X\n",data[0]);
+ return return_value;
+}
