This shows you the differences between two versions of the page.
|
pm:prj2025:ccristi:alex.moldoveanu0510 [2025/05/30 09:09] alex.moldoveanu0510 [Concluzii] |
pm:prj2025:ccristi:alex.moldoveanu0510 [2025/05/30 09:10] (current) alex.moldoveanu0510 [Software Design] |
||
|---|---|---|---|
| Line 68: | Line 68: | ||
| #include "SoftwareSerial.h" | #include "SoftwareSerial.h" | ||
| #include "DFRobotDFPlayerMini.h" | #include "DFRobotDFPlayerMini.h" | ||
| + | #include "LiquidCrystal_I2C.h" | ||
| + | |||
| + | // LCD pe adresa 0x27, cu 16 coloane si 2 randuri | ||
| + | |||
| + | LiquidCrystal_I2C lcd(0x27, 16, 2); | ||
| SoftwareSerial mySoftwareSerial(10, 11); // RX, TX | SoftwareSerial mySoftwareSerial(10, 11); // RX, TX | ||
| DFRobotDFPlayerMini myDFPlayer; | DFRobotDFPlayerMini myDFPlayer; | ||
| + | |||
| void printDetail(uint8_t type, int value); | void printDetail(uint8_t type, int value); | ||
| + | |||
| int play_in_progress=0; // if = 1 then player is working | int play_in_progress=0; // if = 1 then player is working | ||
| + | |||
| const int buttonPin = 2; | const int buttonPin = 2; | ||
| const int buttonPin2 = 7; | const int buttonPin2 = 7; | ||
| - | const int relayPin = 4; | + | const int relayPin = 2; |
| int buttonState = 0; | int buttonState = 0; | ||
| Line 95: | Line 103: | ||
| digitalWrite(relayPin, HIGH); | digitalWrite(relayPin, HIGH); | ||
| | | ||
| - | Serial.println(F("Bun venit!")); | + | lcd.begin(); |
| + | lcd.backlight(); | ||
| + | lcd.clear(); | ||
| + | lcd.setCursor(0, 0); | ||
| + | lcd.print("Sistem activ"); | ||
| myDFPlayer.begin(mySoftwareSerial); | myDFPlayer.begin(mySoftwareSerial); | ||
| Line 119: | Line 131: | ||
| digitalWrite(relayPin, HIGH); | digitalWrite(relayPin, HIGH); | ||
| + | |||
| + | lcd.begin(); | ||
| + | lcd.backlight(); | ||
| + | lcd.clear(); | ||
| + | lcd.setCursor(0, 0); | ||
| + | lcd.print("Sistem activ"); | ||
| + | | ||
| } | } | ||
| Line 136: | Line 155: | ||
| if (waterSensor < 100 && lightSensor < 50) { | if (waterSensor < 100 && lightSensor < 50) { | ||
| digitalWrite(relayPin, LOW); | digitalWrite(relayPin, LOW); | ||
| + | |||
| + | lcd.clear(); | ||
| + | lcd.setCursor(0, 0); | ||
| + | lcd.print("Udare automata"); | ||
| + | |||
| delay(2000); | delay(2000); | ||
| digitalWrite(relayPin, HIGH); | digitalWrite(relayPin, HIGH); | ||
| Line 150: | Line 174: | ||
| manual_watering(); | manual_watering(); | ||
| } | } | ||
| - | } | + | } |
| </code> | </code> | ||