Created
May 4, 2018 20:38
-
-
Save halbright10/f3dd2b4b1b0c7fcafe5f75e520ca9815 to your computer and use it in GitHub Desktop.
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
//YWROBOT | |
//Compatible with the Arduino IDE 1.0 | |
//Library version:1.1 | |
#include <Wire.h> | |
#include <LiquidCrystal_I2C.h> | |
int low = 0; | |
int medium = 0; | |
int high = 0; | |
const int recieveHighPin = A0; | |
const int recieveMediumPin = A1; | |
const int recieveLowPin = A2; | |
LiquidCrystal_I2C lcd(0x3F,20,4); // set the LCD address to 0x27 for a 16 chars and 2 line display | |
void setup() | |
{ | |
lcd.init(); // initialize the lcd | |
lcd.init(); | |
// Print a message to the LCD. | |
lcd.backlight(); | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Hello, world!"); | |
lcd.setCursor(0,1); | |
lcd.print("Hydroponics!"); | |
delay(2500); | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("BADM 395 Project"); | |
lcd.setCursor(2,1); | |
lcd.print("By: HA, MR, CT"); | |
delay(3000); | |
} | |
void loop(){ | |
high = analogRead(recieveHighPin); | |
medium = analogRead(recieveMediumPin); | |
low = analogRead(recieveLowPin); | |
if(high < 1000){ | |
if(medium < 1000){ | |
if(low < 1000){ | |
} else{ | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Low water!"); | |
lcd.setCursor(0,1); | |
lcd.print("Turn off pump!"); | |
} | |
} else { | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Water level:"); | |
lcd.setCursor(0,1); | |
lcd.print("Medium, add soon"); | |
} | |
} else { | |
lcd.clear(); | |
lcd.setCursor(0,0); | |
lcd.print("Water level:"); | |
lcd.setCursor(0,1); | |
lcd.print("Good, be happy!"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment