Advertisement
rafaelnfs

Untitled

Aug 12th, 2020
2,586
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Nombre:Rafael Osorio
  3. Fecha:Agosto 2020
  4. Accion: Lectura analoga temperatura
  5.  
  6.  
  7. Se leera la resistencia del termistor
  8. de vehiculo, para su posterior
  9. procesamiento
  10. */
  11.  
  12.  
  13. void setup() {
  14.  
  15.   // activo la resistencia interna
  16.   // pull up
  17.   pinMode(A0,INPUT_PULLUP);
  18.  
  19.   // para depuracion
  20.   Serial.begin(9600);
  21.    
  22.    
  23. }
  24.  
  25. void loop() {
  26.  
  27. // hacemos la lectura analoga
  28. // del pin A0
  29. int A = analogRead(A0);
  30.  
  31.  
  32. // lo mostramos por puerto Serial
  33. // para motivos de depuracion
  34.  
  35.   Serial.print(" Dato:");
  36.  
  37.   // mapeamos la señal dentro del rango
  38.   // que nos devuelve valor
  39.   int B = map(A,15,150,0,270);
  40.     Serial.println(B);
  41.       delay(1000);  
  42.  
  43. // FIN  
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement