Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Arduino program for plants care
void setup() {
Serial.begin(57600);
for(int i = 2; i <= 10; i+=2){
pinMode(i, OUTPUT);
}
}
void loop() {
String s = "";
for(int i=0; i<5; i++){
int sensor_value = analogRead(i);
int led_number = (i*2) + 2;
if(sensor_value >= 750){
digitalWrite(led_number, HIGH);
} else {
digitalWrite(led_number, LOW);
}
s = s + sensor_value + "\t";
}
Serial.println(s);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment