![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
Basic functions for Gravitech's i2c color sensor
Dependencies: mbed
Dependents: R5 2016 Robotics Team 1
Diff: ColorSensor.cpp
- Revision:
- 1:b4139bd2715f
- Parent:
- 0:42c0a779b199
diff -r 42c0a779b199 -r b4139bd2715f ColorSensor.cpp --- a/ColorSensor.cpp Sun Mar 20 23:28:40 2016 +0000 +++ b/ColorSensor.cpp Sat Apr 09 11:01:08 2016 +0000 @@ -1,13 +1,13 @@ #include "ColorSensor.h" //sda and scl are for your i2c pins -ColorSensor::ColorSensor(PinName sda, PinName scl) : i2c(sda, scl), gain(4), scale(1) +ColorSensor::ColorSensor(PinName sda, PinName scl) : i2c(sda, scl) { //power on device and ADCs i2c.write(ADDR, CTRL, 1); i2c.write(ADDR, CTRL_INIT, 1); - //intial gain is 4x, scale is 1x + //intial gain is 4x, scaler is 1x i2c.write(ADDR, GAIN, 1); i2c.write(ADDR, GAIN_INIT, 1); }