Created
May 17, 2018 12:37
-
-
Save arduinothai/999d51506db905ed66f17e0cf6949948 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; | |
for(int i = 0; i < 1000; i++) { | |
average = average + (.0264 * analogRead(A0) -13.51) / 1000; | |
//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); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment