SHARE
TWEET

Untitled

franciscominajas Aug 25th, 2019 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <LiquidCrystal.h>
  2. #define COLS 16
  3. #define ROWS 2
  4. #define VELOCIDAD 500
  5. LiquidCrystal lcd(3,4,6,7,8,9,10,11,12,13);
  6.  
  7. void setup() {
  8.   Serial.begin(9600);
  9.   lcd.begin(16,2);
  10.   lcd.print(" Temperatura");
  11.   lcd.setCursor(0,1);
  12.   lcd.print(" C=");
  13. }
  14.  
  15. void loop()
  16. {
  17.   float centigrados = leerGradosC();
  18.   //Sacamos por pantalla los grados
  19.   lcd.setCursor(3,1);
  20.   lcd.print(centigrados);
  21.   //Lo realizamos cada segundo
  22.   delay(1000);
  23. }
  24.  
  25. float leerGradosC()
  26. {
  27.   double dato;
  28.   double c;
  29.   dato = analogRead(A0);
  30.   Serial.println(A0);
  31.   //Convertimos el dato de entrada en grados C segun la formula
  32.   c = (analogRead(A0) * 0.004882812 * 100)- 273.15;
  33.   return c;  
  34. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top