Created
May 22, 2015 22:25
-
-
Save Bouhnosaure/60a7ae8b8fb912e3b7f1 to your computer and use it in GitHub Desktop.
arduino.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
int photocellPin = A1; | |
int photocellReading; | |
const int sensorPin = 0; | |
const int hydroAnalog = A2; | |
void setup(void) { | |
Serial.begin(9600); | |
} | |
void loop(void) { | |
int sensorVal = analogRead(sensorPin); | |
photocellReading = analogRead(photocellPin); | |
float voltage = (sensorVal/1024.0) * 5.0; | |
float temperature = (voltage - .5) * 100; | |
int hydroReading = analogRead(hydroAnalog); | |
float pourcentHydro = (hydroReading * 100)/ 800; | |
Serial.print(photocellReading); | |
Serial.print("|"); | |
Serial.print(temperature); | |
Serial.print("|"); | |
Serial.print(pourcentHydro); | |
Serial.print("\n\r"); | |
delay(1000); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment