PAULO PY1CH BUSSOLA ROTOR
/*____________________________________________
PAULOPY1CHBUSSOLAROTOR.ino
__________________________________________
PINO AO LCD AO PINO DIGITAL DO ARDUINO UNO
* LCD RS - ARDUINO 12
* LCD Enable - ARDUINO 11
* LCD D4 - ARDUINO 5
* LCD D5 - ARDUINO 4
* LCD D6 - ARDUINO 3
* LCD D7 - ARDUINO 2
* LCD R/W - ARDUINO GND
*/
// inclui o codigo da biblioteca
#include <LiquidCrystal.h>
// inicia a biblioteca com os numeros dos pinos da interface LCD
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
void setup() {
//set up the LCD's number of columns and rows:
lcd.begin(16, 2);
//Print a message to the LCD.
lcd.print("PAULO PY1CH");
}
void loop() {
lcd.clear();
lcd.print("PAULO PY1CH");
int valor;
int comprimento;
valor = analogRead(A0)*1.029;
String decimal= String(valor, DEC);
// String decimal2 = decimal.substring(4,0);
String tensao= String((valor*0.004887586), DEC);
String tensao2 = tensao.substring(0,4);
comprimento = decimal.length();
lcd.setCursor((4-comprimento),1);
lcd.print(decimal);
lcd.setCursor(8,1);
lcd.print("GRAUS");
delay(200);
}
Comentários
Postar um comentário