26/02/2014, 21:17
27/02/2014, 18:12
27/02/2014, 21:52
jack2234 ha scritto:P.S. può mandarmi in pm qualche schema e sketch che hai fatto??
Sono curioso, non si sa mai che ti possa copiare!![]()
28/02/2014, 10:52
28/02/2014, 14:09
teo94 ha scritto:jack2234 ha scritto:P.S. può mandarmi in pm qualche schema e sketch che hai fatto??
Sono curioso, non si sa mai che ti possa copiare!![]()
Con molto piacere![]()
Però te li invio domani pomeriggio così ti faccio bene gli scanner della flow chart
28/02/2014, 16:25
Gigi75 ha scritto:teo94 ha scritto:jack2234 ha scritto:P.S. può mandarmi in pm qualche schema e sketch che hai fatto??
Sono curioso, non si sa mai che ti possa copiare!![]()
Con molto piacere![]()
Però te li invio domani pomeriggio così ti faccio bene gli scanner della flow chart
Teo, per farmi un'idea, quanto ti è costata costruirla e quanto ti costerà in termini di elettricità annua?
[/size]// Librerie
#include "DHT.h" // libreria sensore DHT e AM2302
#include "swRTC.h" // libreria RTC interno
const float fVerNum = 0.03; // Version number
swRTC rtc;
// Data pin connected to AM2302
#define DHTPIN 2
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); // LED pins
// SETUP
void setup() {
// Setup serial monitor
Serial.begin(9600);
dht.begin();
//Setup RTC
rtc.stopRTC();
rtc.setTime(18, 31, 2);
rtc.startRTC();
}
void lampada(int onoff) {
if(onoff) {
digitalWrite(3, HIGH);
Serial.println("lampada ON");
}
else {
digitalWrite(3,LOW);
Serial.println("lampada OFF");
}
}
void resistenza(int onoff) {
if(onoff) {
digitalWrite(4, HIGH);
Serial.println("resistenza ON");
}
else {
digitalWrite(4, LOW);
Serial.println("resistenza OFF");
}
}
void ventolaesterna(int onoff) {
if(onoff) {
digitalWrite(5, HIGH);
Serial.println("ventest ON");
}
else {
digitalWrite(5, LOW);
Serial.println("ventest OFF");
}
}
void ventolainterna(int onoff) {
if(onoff) {
digitalWrite(6, HIGH);
Serial.println("ventintern ON");
}
else {
digitalWrite(6, LOW);
Serial.println("ventint OFF");
}
}
void pompa(int onoff) {
if(onoff) {
digitalWrite(7, HIGH);
Serial.println("pompa ON");
}
else {
digitalWrite(7, LOW);
Serial.println("pompa OFF");
}
}
void loop() {
Serial.print(rtc.getHours(), DEC);
Serial.print(":");
Serial.println(rtc.getMinutes(), DEC);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float temp = dht.readTemperature();
float ur = dht.readHumidity();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(temp) || isnan(ur)) {
Serial.println(F("Lettura Fallita"));
}
else {
Serial.print(F("Temp: "));
Serial.print(temp);
Serial.println(F("C"));
Serial.print(F("Ur: "));
Serial.print(ur);
Serial.println(F("%\t"));
if((rtc.getHours()>7)&&(rtc.getHours()<19)) {
lampada(1);
ventolainterna(1);
}
else { lampada(0);
ventolainterna(0);
}
if(temp>27) {
while((temp>25)&&(temp<26)) {
resistenza(0);
ventolaesterna(1);
}
ventolaesterna(0);
}
if(temp<23) {
while((temp>25)&&(temp<26)) {
resistenza(1);
}
resistenza(0);
}
if(ur>85){
while((ur>60)&&(ur<70)) {
ventolaesterna(1);
delay(3000);
ventolaesterna(0);
}
}
if(ur<60){
while((ur>60)&&(ur<70)) {
pompa(1);
delay(2000);
pompa(0);
}
}
}
delay(3000); // Ritardo 3 secondi
}
28/02/2014, 16:37
// Librerie
#include "DHT.h" // libreria sensore DHT e AM2302
#include "swRTC.h" // libreria RTC interno
const float fVerNum = 0.03; // Version number
swRTC rtc;
// Data pin connected to AM2302
#define DHTPIN 2
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE); // LED pins
// SETUP
void setup() {
// Setup serial monitor
Serial.begin(9600);
dht.begin();
//Setup RTC
rtc.stopRTC();
rtc.setTime(18, 31, 2);
rtc.startRTC();
}
void lampada(int onoff) {
if(onoff) {
digitalWrite(3, HIGH);
Serial.println("lampada ON");
}
else {
digitalWrite(3,LOW);
Serial.println("lampada OFF");
}
}
void resistenza(int onoff) {
if(onoff) {
digitalWrite(4, HIGH);
Serial.println("resistenza ON");
}
else {
digitalWrite(4, LOW);
Serial.println("resistenza OFF");
}
}
void ventolaesterna(int onoff) {
if(onoff) {
digitalWrite(5, HIGH);
Serial.println("ventest ON");
}
else {
digitalWrite(5, LOW);
Serial.println("ventest OFF");
}
}
void ventolainterna(int onoff) {
if(onoff) {
digitalWrite(6, HIGH);
Serial.println("ventintern ON");
}
else {
digitalWrite(6, LOW);
Serial.println("ventint OFF");
}
}
void pompa(int onoff) {
if(onoff) {
digitalWrite(7, HIGH);
Serial.println("pompa ON");
}
else {
digitalWrite(7, LOW);
Serial.println("pompa OFF");
}
}
void loop() {
Serial.print(rtc.getHours(), DEC);
Serial.print(":");
Serial.println(rtc.getMinutes(), DEC);
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
float temp = dht.readTemperature();
float ur = dht.readHumidity();
// check if returns are valid, if they are NaN (not a number) then something went wrong!
if (isnan(temp) || isnan(ur)) {
Serial.println(F("Lettura Fallita"));
}
else {
Serial.print(F("Temp: "));
Serial.print(temp);
Serial.println(F("C"));
Serial.print(F("Ur: "));
Serial.print(ur);
Serial.println(F("%\t"));
if((rtc.getHours()>7)&&(rtc.getHours()<19)) {
lampada(1);
ventolainterna(1);
}
else { lampada(0);
ventolainterna(0);
}
if(temp>27) {
resistenza(0);
ventolaesterna(1);
}
else { ventolaesterna(0);
}
if(temp<23) {
resistenza(1);
}
else { resistenza(0);
}
if(ur>85){
ventolaesterna(1);
delay(3000);
ventolaesterna(0);
}
}
if(ur<60){
pompa(1);
delay(2000);
pompa(0);
}
delay(3000); // Ritardo 3 secondi
}
02/03/2014, 20:40
teo94 ha scritto:Mentre questo è il secondo sketch: ho sostituito i cicli while con degli if e in questo modo funziona correttamente.
[sIn tutti e due gli sketch mancano la gestione del display lcd e il pulsante per le luci.
n.b: Voglio anche dirvi che questo progetto sarà la mia tesina per la maturità.
02/03/2014, 21:34
pioppino ha scritto:non capisco l'utilizzo delle ventole perchè fare girare l'aria ???
ciao nino
03/03/2014, 1:16
Powered by phpBB © phpBB Group.
phpBB Mobile / SEO by Artodia.