Skip to content

Instantly share code, notes, and snippets.

@li2hub
Last active October 3, 2018 11:54
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 li2hub/b143f2f8f6969c018e003ecda7a3f4d7 to your computer and use it in GitHub Desktop.
Save li2hub/b143f2f8f6969c018e003ecda7a3f4d7 to your computer and use it in GitHub Desktop.
int soil_val=0, thresh=500;
void setup(){
pinMode(D5,OUTPUT);
pinMode(D6,OUTPUT);
}
void loop(){
soil_val=analogRead(A0);
if(soil_val>thresh){
digitalWrite(D5,HIGH);
digitalWrite(D6,LOW);
}
else{
digitalWrite(D5,LOW);
digitalWrite(D6,HIGH);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment