Κυριακή 16 Φεβρουαρίου 2025

LCD οθόνη και arduino

LCD οθόνη


// C++ code

//

#include <LiquidCrystal_I2C.h>


LiquidCrystal_I2C lcd_2(39, 16, 2);


void setup()

{

  lcd_2.init();


  lcd_2.clear();

}


void loop()

{

  lcd_2.setCursor(0, 0);

  lcd_2.print("hello world");

  delay(1000); // Wait for 1000 millisecond(s)

  lcd_2.setCursor(0, 1);

  lcd_2.print("Are you Ok ?");

}

χρήσιμες εντολές για την οθόνη:

include <LiquidCrystal.h>  καλούμε τη βιβλιοθήκη για την οθόνη που θα πρέπει να έχουμε κατεβάσει-εγκαταστήσει

 lcd.scrollDisplayRight(); 

 lcd.scrollDisplayLeft();

Με τις εντολές αυτές μπορούμε να έχουμε κινούμενο κείμενο προς την κατεύθυνση της εντολής

Σάββατο 8 Φεβρουαρίου 2025

watering plants and screen

 υγρασία εδάφους

κώδικας για ρύθμιση 

/* Change these values based on your calibration values */
#define soilWet 500   // Define max value we consider soil 'wet'
#define soilDry 750   // Define min value we consider soil 'dry'

// Sensor pins
#define sensorPower 7
#define sensorPin A0

void setup() {
	pinMode(sensorPower, OUTPUT);
	
	// Initially keep the sensor OFF
	digitalWrite(sensorPower, LOW);
	
	Serial.begin(9600);
}

void loop() {
	//get the reading from the function below and print it
	int moisture = readSensor();
	Serial.print("Analog Output: ");
	Serial.println(moisture);

	// Determine status of our soil
	if (moisture < soilWet) {
		Serial.println("Status: Soil is too wet");
	} else if (moisture >= soilWet && moisture < soilDry) {
		Serial.println("Status: Soil moisture is perfect");
	} else {
		Serial.println("Status: Soil is too dry - time to water!");
	}



	
	delay(1000);	// Take a reading every second for testing
					// Normally you should take reading perhaps once or twice a day
	Serial.println();
}

//  This function returns the analog soil moisture measurement
int readSensor() {
	digitalWrite(sensorPower, HIGH);	// Turn the sensor ON
	delay(10);							// Allow power to settle
	int val = analogRead(sensorPin);	// Read the analog value form sensor
	digitalWrite(sensorPower, LOW);		// Turn the sensor OFF
	return val;							// Return analog moisture value
}


κώδικας με LCD οθόνη:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
LiquidCrystal_I2C lcd(0x27,16,2);  // set the LCD address to 0x27 for a 16 chars and 2 line display
/* Change these values based on your calibration values */
#define soilWet 500   // Define max value we consider soil 'wet'
#define soilDry 750   // Define min value we consider soil 'dry'

// Sensor pins
#define sensorPower 7
#define sensorPin A0


void setup() {
  pinMode(sensorPower, OUTPUT);
  lcd.init();                      // initialize the lcd
    // Print a message to the LCD.
  lcd.backlight();
  // Initially keep the sensor OFF
  digitalWrite(sensorPower, LOW);
 
  Serial.begin(9600);
}
void loop() {
  int moisture = readSensor(); //get the reading from the function below and print it
  Serial.print("Analog Output: ");
  Serial.println(moisture);
  lcd.setCursor(3,0);
  lcd.print(moisture);
  delay(1000);
 
  // Determine status of our soil
  if (moisture < soilWet) {
    Serial.println("Status: Soil is too wet");
    lcd.setCursor(1,0);
    lcd.print("Soil is too wet");
   
  } else if (moisture >= soilWet && moisture < soilDry) {
      Serial.println("Status: Soil moisture is perfect");
      lcd.setCursor(1,0);
      lcd.print("Soil moisture is perfect");
     
  } else {
    Serial.println("Status: Soil is too dry - time to water!");
    lcd.setCursor(1,0);
    lcd.print("Soil is too dry");
    lcd.setCursor(1,1);
    lcd.print("time to water!");
   
  }
   
  delay(1000);  // Take a reading every second for testing
          // Normally you should take reading perhaps once or twice a day
  Serial.println();
  lcd.clear();
}

//  This function returns the analog soil moisture measurement
int readSensor() {
  digitalWrite(sensorPower, HIGH);  // Turn the sensor ON
  delay(10);              // Allow power to settle
  int val = analogRead(sensorPin);  // Read the analog value form sensor
  digitalWrite(sensorPower, LOW);   // Turn the sensor OFF
  return val;             // Return analog moisture value
}






Δευτέρα 28 Ιουνίου 2021

piscine-EELAK

 https://www.makerguides.com/character-i2c-lcd-arduino-tutorial/

https://www.teachmemicro.com/arduino-i2c-lcd/

https://www.instructables.com/How-to-Connect-I2C-Lcd-Display-to-Arduino-Uno/

https://create.arduino.cc/projecthub/dirar/lcd-button-writer-6b94b3

https://how2electronics.com/gas-leakage-detector-email-alert-notification-esp32/

https://randomnerdtutorials.com/esp32-email-alert-temperature-threshold/

http://www.learningaboutelectronics.com/Articles/2-motor-H-bridge-circuit.php

https://tqb.li2.in/unit/how-to-interface-2-dc-motors-with-an-arduino-using-an-h-bridge/

https://openlabpro.com/guide/dc-motor-control-using-esp32/

https://www.espressif.com/en/products/devkits/esp32-devkitc/overview

https://www.circuitbasics.com/set-bmp180-barometric-pressure-sensor-arduino/