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.
Revision 3:b3c41c85fb1e, committed 2013-11-21
- Comitter:
- TaintedTruth
- Date:
- Thu Nov 21 00:21:52 2013 +0000
- Parent:
- 2:5c0159599726
- Commit message:
- testing stuff;
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Thu Nov 21 00:13:13 2013 +0000
+++ b/main.cpp Thu Nov 21 00:21:52 2013 +0000
@@ -2,22 +2,21 @@
#include "m3pi.h"
DigitalOut sensorLED(p8);
-I2C colorSensor(p28, p27);
+I2C colorSensor(p28, p27); //SDA, SCL
Serial bt(p13, p14); // tx, rx
const int addr = 0x74;
+const int addr1 = 0x75;
m3pi m3pi;
int read(char lowByteRegister) {
char cmd[1];
- char echo[1];
- bt.printf("E:%0x ",echo[0]);
+ char echo[2];
cmd[0] = lowByteRegister;
colorSensor.write(addr,cmd,1);
- colorSensor.read(addr,echo,1);
+ colorSensor.read(addr,echo,2);
int result_low = (int) echo[0];
- bt.printf("lo:%0x ",result_low);
/*
cmd[0] = lowByteRegister + 1;
@@ -47,6 +46,10 @@
cmd[1] = 0x01;
colorSensor.write(addr,cmd,2);
+ cmd[0] = 0x06;
+ cmd[1] = 0x04;
+ colorSensor.write(addr,cmd,2);
+
int red = read(0x06);
// int green = read(0x42);
// int blue = read(0x44);
