Академический Документы
Профессиональный Документы
Культура Документы
/*
LiquidCrystal Library - Hello World
Demonstrates the use a 16x2 LCD display. The LiquidCrystal
library works with all LCD displays that are compatible with the
Hitachi HD44780 driver. There are many of them out there, and you
can usually tell them by the 16-pin interface.
This sketch prints "Hello World!" to the LCD
and shows the time.
The circuit:
* LCD RS pin to digital pin 12
* LCD Enable pin to digital pin 11
* LCD D4 pin to digital pin 5
* LCD D5 pin to digital pin 4
* LCD D6 pin to digital pin 3
* LCD D7 pin to digital pin 2
* LCD R/W pin to ground
* 10K resistor:
* ends to +5V and ground
* wiper to LCD VO pin (pin 3)
lcd.print(VAR5);
lcd.setCursor(8, 0);
lcd.print("VAR6=");
lcd.setCursor(13, 0);
lcd.print(VAR6);
lcd.setCursor(0, 1);
lcd.print("VAR7=");
lcd.setCursor(5, 1);
lcd.print(VAR7);
lcd.setCursor(8, 1);
lcd.print("VAR8=");
lcd.setCursor(13, 1);
lcd.print(VAR8);
delay(2000);
lcd.clear();
}
PRCTICA 19. ESCRIBIENDO DESDE LA COMPUTADORA EN LA MISMA LNEA
// include the library code:
#include <LiquidCrystal.h>
int tope=0;
// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup(){
// Inicializa La LCD con el nmero de columnas y filas:
lcd.begin(16, 2);
// initialize the serial communications:
Serial.begin(9600);
}
void loop()
{
lcd.blink();
// delay(3000);
// when characters arrive over the serial port...
if (Serial.available()) {
// wait a bit for the entire message to arrive
delay(100);
// clear the screen
//lcd.clear();
// read all the available characters
while (Serial.available() > 0) {
lcd.setCursor(8, 1);
lcd.print(voltaje,3); //DELIMITO NMERO DE DECIMALES A 3 CON NMEROS FLOTANTES
delay(100);//OPCIONAL
}
PRCTICA 22. PIZARRA ELECTRNICA
lcd.print(VISITA);
}
}
//lcd.setCursor(x, y);
void loop() {
VALORL = digitalRead(PLOCAL); // lee el valor de la entrada digital pin 7
if (VALORL==0){
while (VALORL==0){
VALORL = digitalRead(PLOCAL); // lee el valor de la entrada digital pin 7
delay(20);}
if (LOCAL>=99){
LOCAL=0;
MOSTRAR();
}
else{
LOCAL++;
MOSTRAR();
}
}
else {
VALORV = digitalRead(PVISITA); // lee el valor de la entrada digital pin 8
if (VALORV==0){
while (VALORV==0){
VALORV = digitalRead(PVISITA); // lee el valor de la entrada digital pin 8
delay(20);}
if (VISITA>=99){
VISITA=0;
MOSTRAR();
}
else{
VISITA++;
MOSTRAR();
}
}
}
}