Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if defined(FLOW_METER)
- //vcc adjustment, since ref 1.1V is not exact
- const float flow_vcc_calibration = 1;
- #endif
- #if defined(FLOW_METER)
- //emon1.readVcc() returns vcc in mV compared to internal reference 1.1V voltage
- float vcc = emon1.readVcc() * flow_vcc_calibration / 1000.0;
- int f = analogRead(A6);
- float flow_ = f * (vcc / 1023.0);
- int t = analogRead(A7);
- float temp_ = t * (vcc / 1023.0);
- float flow = (flow_ - 0.375) / 0.03125;
- float temp = (temp_ - 0.5) / 0.03;
- Serial.print("FM");
- Serial.print(flow);
- Serial.print(',');
- Serial.print(temp);
- Serial.print(',');
- #endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement