Subj : Re: moisture sensor To : Avon From : Jeff Date : Mon Jan 24 2022 01:12:43 On 24 Jan 2022, Avon said the following... Av> That sounds really neat. I have not played with Ardunio gear but it Av> sounds like it would be something ideally suited for what you have used. Av> Are there scripts along these lines you can download from other Ardunio Av> users or is this something you just whipped up yourself ;-) The code is pretty straightforward, really, if anyone wants to do something similar. The only things that aren't are that pin 13 is the "alert" LED -- to let me kow that something needs watering, ping 15-19 are the analog inputs from the moisture sensors, and text coordinates for the 16x2 LCD display are in Y,X format. ----- #include LiquidCrystal lcd(12, 11, 5, 4, 3, 2); char *plants[]={"1 Rosemary", "2 Thyme", "3 Oregano", "4 Basil", "5 Rosemary"}; byte levels[] ={ 10, 20, 20, 30, 10}; void setup() { Serial.begin(9600); lcd.begin(16, 2); pinMode(13, OUTPUT); } void loop() { byte i; int raw; int percent; int alert; alert=LOW; for(i=0; i<5; i++) { lcd.clear(); raw = analogRead(15+i); lcd.print(plants[i]); lcd.setCursor(11,0); lcd.print("("); lcd.print(levels[i]); lcd.print("%)"); percent=map(raw, 550, 285, 0, 100); lcd.setCursor(0,1); lcd.print("Moisture: "); lcd.print(percent); lcd.print("%"); if(percent