Skip to content

Instantly share code, notes, and snippets.

@phsheth
Created February 6, 2018 16:03
Show Gist options
  • Save phsheth/a79c153dbc6cf15bb1ddad77e5393f50 to your computer and use it in GitHub Desktop.
Save phsheth/a79c153dbc6cf15bb1ddad77e5393f50 to your computer and use it in GitHub Desktop.
void setup() {
// put your setup code here, to run once:
Serial.begin(19200);
}
void loop() {
// put your main code here, to run repeatedly:
//Voltage
float voltageRead1 = analogRead(A0);
float voltageRead2 = analogRead(A1);
float voltageRead3 = analogRead(A2);
float voltageRead4 = analogRead(A3);
float voltage1 = 22.32*4.88*voltageRead1/1024; //Converts
float voltage2 = 22.32*4.88*voltageRead2/1024; //Converts
float voltage3 = 22.32*4.88*voltageRead3/1024; //Converts
float voltage4 = 22.32*4.88*voltageRead4/1024; //Converts
Serial.print(",");
Serial.print(voltage1-voltage2);
Serial.print(",");
Serial.print(voltage2-voltage3);
Serial.print(",");
Serial.print(voltage3-voltage4);
Serial.print(",");
Serial.print(voltage4);
Serial.println(",");
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment