Created
April 4, 2020 23:53
-
-
Save neodevelop/572c7c1f24bbc4a5718057e2134f9986 to your computer and use it in GitHub Desktop.
Arduino program for plants care
This file contains hidden or 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
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