A place for all the arduino code I write.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

23 lines
463 B

int soilPin = A0;
float referenceVoltage = 5;
void setup() {
Serial.begin(9600);
Serial.println("Analogue Soil Sensor Test");
Serial.println("=========================");
}
void loop() {
int rawValue = analogRead(soilPin);
float parsedValue = (float)rawValue / 1024 * referenceVoltage;
Serial.print("Raw Value: ");
Serial.print(rawValue);
Serial.print(" Parsed Value: ");
Serial.print(parsedValue);
Serial.println("V");
delay(1000);
}