Skip to content

Instantly share code, notes, and snippets.

@dsvakola
Created January 13, 2024 02:32
Show Gist options
  • Save dsvakola/2e644c2f30242ce6b57c4d481fb79a5c to your computer and use it in GitHub Desktop.
Save dsvakola/2e644c2f30242ce6b57c4d481fb79a5c to your computer and use it in GitHub Desktop.
/* Understanding the use of Serial Monitor & Serial Plotter to measure actual voltage using Arduino */
int potpin = A0;
float pot_voltage = 0;
float actualvoltage;
void setup()
{
Serial.begin(9600);
}
void loop()
{
pot_voltage = analogRead(potpin);
actualvoltage = ((pot_voltage)*(4.9/1023.0));
Serial.print("Pot Voltage: ");
Serial.print(actualvoltage);
Serial.println("V");
delay(1000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment