CatPot 2015-2016
/
Pr034_S11059
S11059-02DT
Diff: main.cpp
- Revision:
- 1:eabfa27c9374
- Parent:
- 0:e2155c63b32b
- Child:
- 2:059b9459d344
--- a/main.cpp Fri Apr 10 14:17:59 2015 +0000 +++ b/main.cpp Tue Apr 14 07:28:02 2015 +0000 @@ -3,7 +3,7 @@ DigitalOut Led(LED1); DigitalOut Val(LED2); Serial pc(USBTX,USBRX); -I2C Sensor(p9,p10); +I2C Sensor(p28,p27); #define DEVICE_ADDRESS 0x2A #define CONTROL_REG 0x00 @@ -69,28 +69,78 @@ // 10= 22.4ms // 11= 179.2ms + /* + Sensor.start(); + + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x00); + Val = Sensor.write(0x84); + + Sensor.stop(); + + Sensor.start(); + + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x00); + Val = Sensor.write(0x04); + + Sensor.stop(); + + + wait_ms(180*4); //total exposure time + */ Sensor.start(); - ord[0]=0x00; - ord[1]=0x84; - Val = !Sensor.write(address&0xFE, ord, 2, true); - ord[0]=0x00; - ord[1]=0x04; - Val = !Sensor.write(address&0xFE, ord, 2, false); + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x00); + Val = Sensor.write(0x89); + + //Sensor.stop(); + + Sensor.start(); + + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x00); + Val = Sensor.write(0x09); + + Sensor.stop(); + + + - wait_ms(180*4); //total exposure time + Sensor.start(); + + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x03); + Val = Sensor.write(0x00); + + //Sensor.stop(); + + Sensor.start(); + + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x04); + Val = Sensor.write(0x00); + + Sensor.stop(); + + //wait_ms(5.6*4); //total exposure time led_blink(); Sensor.start(); - ord[0]=0x03; - Val = !Sensor.write(address&0xFE, ord, 1, true); + Val = Sensor.write(address&0xFE); + Val = Sensor.write(0x03); - Val = !Sensor.write(address|0x01); + //Sensor.stop(); + + Sensor.start(); + + Val = Sensor.write(address|0x01); //read data @@ -121,7 +171,7 @@ int main() { - Sensor.frequency(10000); + //Sensor.frequency(10000); Led=0; led_blink();