Quantcast
Channel: fritzing forum - Latest posts
Viewing all articles
Browse latest Browse all 29610

Reading 2 voltages simultaneously with Arduino

$
0
0

It's not possible to do 2 things at the same time.
But you can read A1 just after A0:

void loop() {
// read the input on analog pin 0:
int sensorValue0 = analogRead(A0);
int sensorValue1 = analogRead(A1);
// Convert the analog reading (which goes from 0 - 1023) to a voltage (0 - 5V):
float voltage0 = sensorValue0 * (5.0 / 1023.0);
float voltage1 = sensorValue1 * (5.0 / 1023.0);
// print out the value you read:
Serial.println(voltage0);
Serial.println(voltage1);
}


Viewing all articles
Browse latest Browse all 29610

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>