Skip to content

Instantly share code, notes, and snippets.

@enachb
Created April 28, 2015 20:27
Show Gist options
  • Select an option

  • Save enachb/a94c5a422be8de5236a0 to your computer and use it in GitHub Desktop.

Select an option

Save enachb/a94c5a422be8de5236a0 to your computer and use it in GitHub Desktop.
// 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