Created
September 24, 2016 23:06
-
-
Save figital/a5dc8ec0fe63a3b53c1d9ea2c68f2e7f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void setup() { | |
Serial.begin(9600); | |
} | |
void loop() { | |
float average = 0.00; | |
float c = analogRead(A5); | |
int sampleSize = 1000; | |
for (int i = 1; i <= sampleSize; i++ ) { | |
average = average + (0.0445 * c - 22.8) / 1000; | |
//average = .04 * c; | |
//5A mode, if 20A or 30A mode, need to modify this formula to | |
//(.19 * analogRead(A0) -25) for 20A mode and | |
//(.044 * analogRead(A0) -3.78) for 30A mode | |
delay(1); | |
} | |
//Serial.println((average -18.79) * -1); | |
Serial.println(average); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment