Documentos de Académico
Documentos de Profesional
Documentos de Cultura
GUIA DE LABORATORIO N° 8
FUNDAMENTOS DE SISTEMAS DE CONTROL ELECTRONICO
ELEMENTO DE CAPACIDAD Explicar con precisión los tipos de sensores en los sistemas de control industrial, de acuerdo a las
especificaciones técnicas, estándares de calidad y seguridad establecidas en la normativa vigente
INDICADOR DE LOGRO Selecciona los principales dispositivos e instrumentos de medición usados en sistemas de control
industrial de acurdo a normas técnicas establecidas.
III.- DESARROLLO DE LA ACTIVIDAD:
#define TRIGGER_PIN 2 // Arduino pin tied to trigger pin on the ultrasonic sensor.
#define ECHO_PIN 3 // Arduino pin tied to echo pin on the ultrasonic sensor.
#define MAX_DISTANCE 400 // Maximum distance we want to ping for (in centimeters). Maximum sensor distance is rated at 400-
500cm.
NewPing sonar(TRIGGER_PIN, ECHO_PIN, MAX_DISTANCE); // NewPing setup of pins and maximum distance.
void setup() {
Serial.begin(115200); // Open serial monitor at 115200 baud to see ping results.
lcd.begin(16, 2);
}
void loop() {
delay(100); // Wait 100ms between pings (about 20 pings/sec). 29ms should be the shortest delay between pings.
unsigned int uS = sonar.ping(); // Send ping, get ping time in microseconds (uS).
Serial.print("Ping: ");
Serial.print(uS / US_ROUNDTRIP_CM); // Convert ping time to distance in cm and print result (0 = outside set distance range)
Serial.println("cm");
lcd.setCursor(0, 0);
lcd.print("Distance:");
lcd.setCursor(0, 1);
lcd.print(" ");
lcd.setCursor(9, 1);
lcd.print(uS / US_ROUNDTRIP_CM);
lcd.setCursor(12, 1);
lcd.print("cm");
}