#include < Wire.h >
#include < Arduino.h >
#define SENSORADDRESS 0x07 // each I2C object has a unique bus address, the DS1307 is 0x68
void setup()
{
Wire.begin(); // wake up I2C bus
delay (500);
Serial.begin(9600);
}
void loop()
{
Wire.beginTransmission(SENSORADDRESS);
Wire.write(1);
Wire.endTransmission();
delay (20);
Wire.requestFrom(SENSORADDRESS, 2);
for (int i=0;i < 20;i++)
{
int aread = analogRead(0);
Serial.print( "an:" );
Serial.println(aread);
delay (10);
}
while(Wire.available() == 0){};
byte a = Wire.read();
byte b = Wire.read();
int flow = ((a << 8) + b) / 10;
Serial.print("Flow ");
Serial.println(flow);
}