Skip to content

Commit

Permalink
Create voltage.ino
Browse files Browse the repository at this point in the history
file to read voltage from the plant
  • Loading branch information
robbiebarrat authored Feb 19, 2018
1 parent ff1c25f commit 77364e0
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions voltage.ino
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
void setup() {
// initialize serial communication at 9600 bits per second:
Serial.begin(9600);
}

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

0 comments on commit 77364e0

Please sign in to comment.