Buongiorno, devo creare un progetto per l'esame di stato, frequento un istituto elettronico.
In rete ho trovato un progetto niente male, sull'irrigazione automatica con arduino, il programma è il seguente ma ho alcuni problemi.
Lo scopo di questo circuito è attivare la pompa quando il sensore di umidità scende sotto un livello preimpostato da noi.
-Alcune variabili sono a me sconosciute, come per esempio: voltageFlipPin2, voltageFlipPin1,flipTimer , setSensorPolarity(boolean flip)..Se qualcuno potrebbe spiegarmele cortesemente
-Non riesco a creare un Flow Chart, credo non sia molto complicato ma non riesco a tirar fuori nulla, se qualcuno potrebbe darmi anche uno spunto per iniziare. Il flow chart vorrei farlo con Dia e dovrei specificare tutti i passaggi, senza usare linguaggio di programmazione (Esempio: Definire variabili-->ecc..)
Grazie mille
#include <LiquidCrystal.h> // Include the library to use a LCD display
#define voltageFlipPin1 6
#define voltageFlipPin2 7
#define sensorPin 0
#define motore 8
const int analogInPin = A1; //* Analog input pin that the potentiometer is attached to
int sensorValue = 0; //* value read from the pot
int outputValue = 0; // *value output to the PWM (analog out)
int Vin; // Variable to read the value from the Arduino’s pin
int flipTimer = 1000;
LiquidCrystal lcd (12, 11, 5, 4, 3, 2);
/* The function above declares which Arduino’s pins will be used for controlling the LCD */
void setup(){
Serial.begin(9600);
pinMode(voltageFlipPin1, OUTPUT);
pinMode(voltageFlipPin2, OUTPUT);
pinMode(sensorPin, INPUT);
pinMode(motore, OUTPUT);
lcd.begin(16, 2); // It tells the Arduino that the display is a 16x2 type
lcd.print("UMIDITA'TERRENO: "); // Send the text to the screen of the display.
}
void setSensorPolarity(boolean flip){
if(flip){
digitalWrite(voltageFlipPin1, HIGH);
digitalWrite(voltageFlipPin2, LOW);
}else{
digitalWrite(voltageFlipPin1, LOW);
digitalWrite(voltageFlipPin2, HIGH);
}
}
void loop(){
//* read the analog in value:
sensorValue = analogRead(analogInPin);
// map it to the range of the analog out:
outputValue = map(sensorValue, 0, 1023, 0, 1023);
// change the analog out value:
// print the results to the serial monitor:
Serial.print("sensor = " );
Serial.print(sensorValue);
Serial.print("\t output = ");
Serial.println(outputValue);
//*
setSensorPolarity(true);
delay(flipTimer);
int val1 = analogRead(sensorPin);
delay(flipTimer);
setSensorPolarity(false);
delay(flipTimer);
// invert the reading
int val2 = 1023 - analogRead(sensorPin);