Professional Documents
Culture Documents
Practica Display
Practica Display
Parts required:
220 ohm resistor
10 kilohm resistor
10 kilohm potentiometer
16x2 LCD screen
tilt switch
http://arduino.cc/starterKit
void setup() {
Serial.begin(9600);
// set up the number of columns and rows on the LCD
lcd.begin(16, 2);
Serial.println("CARLOS NINO!");
}
void loop() {
// check the status of the switch
switchState = digitalRead(switchPin);
//Modified by #aprendiendoarduino
if (Serial.available()) {
reply = random(8);
//doy emoción a la respuesta :-)
for (int i=0;i<5;i++){
Serial.print(".");
delay(1000);
}
Serial.println(".");
lcd.clear();
lcd.home();
int numero_caracter = 0;
while (Serial.available() > 0) {
if (numero_caracter >= 16) lcd.autoscroll(); //Activo el scroll a partir
del caracter 16
// display each character to the LCD
lcd.write(Serial.read());
delay(10);
numero_caracter++;
}
lcd.noAutoscroll(); //Desactivo el autoscroll
lcd.setCursor(0, 1);
case 5:
lcd.print("Ask again");
Serial.println("Ask again");
break;
case 6:
lcd.print("Doubtful");
Serial.println("Doubtful");
break;
case 7:
lcd.print("No");
Serial.println("No");
break;
}
delay(1000);
}
case 1:
lcd.print("Most likely");
break;
case 2:
lcd.print("Certainly");
break;
case 3:
lcd.print("Outlook good");
break;
case 4:
lcd.print("Unsure");
break;
case 5:
lcd.print("Ask again");
break;
case 6:
lcd.print("Doubtful");
break;
case 7:
lcd.print("No");
break;
}
}
}