// include the library code:
#include <LiquidCrystal.h>
// initialize the library by associating any needed LCD interface pin
// with the arduino pin number it is connected to
const int rs = 13, en = 12, d4 = 11, d5 = 10, d6 = 9, d7 = 8;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);
#define LDR_PIN A0
#define SENSOR_PIR_PIN 6
void setup() {
Serial.begin(115200);
Serial.println("Medicion de Sensores con Arduino !");
// set up the LCD's number of columns and rows:
lcd.begin(16, 2);
// Print a message to the LCD.
lcd.print("Sensores con Arduino!");
}
void loop() {
int val_ldr = analogRead(LDR_PIN);
int val_ldr_f = map(val_ldr,0, 1023, 100, 0 );
//-------------------------------------
lcd.setCursor(0,1);
lcd.print("LDR: ");
lcd.print(val_ldr_f);
delay(100);
lcd.setCursor(0,1);
lcd.print("LDR: ");
//-------------------------------------
int lect_pir = int(digitalRead(SENSOR_PIR_PIN));
if (lect_pir == 1) {
lcd.setCursor(9,1);
lcd.print("Move ...! ");
}else{
lcd.setCursor(9,1);
lcd.print("NO Move !!! ");
}
}