Professional Documents
Culture Documents
#include <LiquidCrystal.h>
#define echoPin 7 // Echo Pin
#define trigPin 8 // Trigger Pin
#define LEDPin 13 // Onboard LED
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(LEDPin, OUTPUT); // Use LED indicator (if required)
}
void loop() {
/* The following trigPin/echoPin cycle is used to determine the
distance of the nearest object by bouncing soundwaves off of it. */
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
duration = pulseIn(echoPin, HIGH);
if(distance<40){
lcd.setCursor(0, 1);
lcd.print("alerta");
delay(10);
}
digitalWrite(LEDPin, LOW);
}
Colocacion LCD
https://forum.arduino.cc/index.php?topic=146173.0
https://www.arduino.cc/en/Tutorial/HelloWorld
Sensores
http://wiki.robotica.webs.upv.es/wiki-de-robotica/sensores/sensores-proximidad/
sensor-de-ultrasonidos/
http://arduinobasics.blogspot.com/2012/11/hc-sr04-ultrasonic-sensor.html
Librería
https://forum.arduino.cc/index.php?topic=402270.0
Tipos de sensores
http://www.superrobotica.com/sensores.htm