Skip to content

Instantly share code, notes, and snippets.

@neodevelop
Created April 4, 2020 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save neodevelop/572c7c1f24bbc4a5718057e2134f9986 to your computer and use it in GitHub Desktop.
Save neodevelop/572c7c1f24bbc4a5718057e2134f9986 to your computer and use it in GitHub Desktop.
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