Created
April 28, 2015 20:27
-
-
Save enachb/a94c5a422be8de5236a0 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| // Compute factor for amps calculation | |
| const float factor = 5.0 / 1023.0 / 5.0 * 600.0 | |
| void setup() | |
| { | |
| // initialize serial communication at 9600 bits per second: | |
| Serial.begin(9600); | |
| } | |
| void loop() | |
| { | |
| // float voltage = sensorValue * (5.0 / 1023.0); | |
| float amps0 = (analogRead(A0) * factor; | |
| float amps1 = (analogRead(A1) * factor; | |
| float amps2 = (analogRead(A2) * factor; | |
| float amps3 = (analogRead(A3) * factor; | |
| float amps4 = (analogRead(A4) * factor; | |
| float amps5 = (analogRead(A5) * factor; | |
| // Serial.print(voltage); | |
| Serial.print(amps0); | |
| Serial.print(", "); | |
| Serial.print(amps1); | |
| Serial.print(", "); | |
| Serial.print(amps2); | |
| Serial.print(", "); | |
| Serial.print(amps3); | |
| Serial.print(", "); | |
| Serial.print(amps4); | |
| Serial.print(", "); | |
| Serial.println(amps5); | |
| delayMicroseconds(300); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment