From 355ae6d159fa533d48b6d71b4b2a518721b03634 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20=C3=81lvarez?= Date: Fri, 26 Feb 2016 22:16:12 +0100 Subject: [PATCH] sensor de luz en proyecto comentado MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit el sensor que tengo solo da salida digital, y necesito analógica. Así que lo dejo comentado hasta conseguir uno. --- sketch_lcd/sketch_lcd.ino | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/sketch_lcd/sketch_lcd.ino b/sketch_lcd/sketch_lcd.ino index 82d3c36..c25a7a3 100644 --- a/sketch_lcd/sketch_lcd.ino +++ b/sketch_lcd/sketch_lcd.ino @@ -1,27 +1,41 @@ -// https://www.arduino.cc/en/Reference/LiquidCrystal -// https://www.youtube.com/watch?v=dZZynJLmTn8 -// https://www.youtube.com/watch?v=R-CRIthB7ZY -// http://howtomechatronics.com/tutorials/arduino/lcd-tutorial/ +/* +LCD: + +https://www.arduino.cc/en/Reference/LiquidCrystal +https://www.youtube.com/watch?v=dZZynJLmTn8 +https://www.youtube.com/watch?v=R-CRIthB7ZY +http://howtomechatronics.com/tutorials/arduino/lcd-tutorial/ + + +DHT (temp & hum) + +https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino +*/ #include #include -#define DHT_APin A0 // Pin Análogico al que he conectado el sensor +#define LED_Pin 13 // Pin del led de la placa +#define DHT_APin A0 // Pin Análogico al que he conectado el sensor de temperatura #define DHT_Type DHT22 // mi sensor es el DHT11 +//#define PHOTORES_APin 3 // Pin Análogico al que he conectado el sensor de luz // init DHT dht(DHT_APin, DHT_Type); LiquidCrystal lcd(9, 10, 4, 5, 6, 7); // syntax: LiquidCrystal(rs, enable, d4, d5, d6, d7) int timer = 0; +int interval = 60; +//int luz; void setup() { // put your setup code here, to run once: Serial.begin(9600); dht.begin(); lcd.begin(16, 2); - pinMode(13, OUTPUT); // 13 es el pin con el led + pinMode(LED_Pin, OUTPUT); + //pinMode(PHOTORES_APin, INPUT); lcd.print(" hue hue hue"); @@ -44,6 +58,8 @@ void loop() { // put your main code here, to run repeatedly: // Compute heat index in Celsius (isFahreheit = false) float hic = dht.computeHeatIndex(t, h, false); // sensación térmica + //luz = digitalRead(PHOTORES_APin); + // D = DHT, para el script en python que leerá esto Serial.print("D h:"); Serial.print(h); @@ -51,6 +67,8 @@ void loop() { // put your main code here, to run repeatedly: Serial.print(t); Serial.print(" i:"); Serial.print(hic); + //Serial.print(" l:"); + //Serial.print(luz); Serial.println(""); lcd.clear(); @@ -67,7 +85,7 @@ void loop() { // put your main code here, to run repeatedly: digitalWrite(13, LOW); //delay(60000); // 1 minuto - timer = 60; + timer = interval; } lcd.setCursor(14, 2);