Diferencia entre revisiones de «Mini horno»

De fabwiki
Ir a la navegación Ir a la búsqueda
Página creada con « * * AREF Analog pin 0 * | | * 3.3V |-+---/\/\/\-----+-----/\/\/\-----| GND * * ^ ^ * 10K thermistor 10K resistor: #include <SmoothThermistor.h> float t_objectivo = 15; SmoothThermistor smoothThermistor(A0, // the analog pin to read from ADC_SIZE_10_BIT, // the ADC size 10000, /…»
 
Sin resumen de edición
Línea 1: Línea 1:
 
<pre>
/*
/*
  *
  *
Línea 53: Línea 53:
   delay(1000);
   delay(1000);
}
}
</pre>

Revisión del 11:42 4 jul 2026

/*
 *
 *          AREF      Analog pin 0
 *           |              |
 *    3.3V |-+---/\/\/\-----+-----/\/\/\-----| GND
 *
 *                 ^                ^ 
 *          10K thermistor     10K resistor
 */
#include <SmoothThermistor.h>

float t_objectivo = 15;

SmoothThermistor smoothThermistor(A0,              // the analog pin to read from
                                   ADC_SIZE_10_BIT, // the ADC size
                                   10000,           // the nominal resistance
                                   10000,           // the series resistance
                                   3950,            // the beta coefficient of the thermistor
                                   25,              // the temperature for nominal resistance
                                   10);             // the number of samples to take for each measurement

void setup() {
  Serial.begin(9600);
  smoothThermistor.useAREF(true);
  pinMode(12, OUTPUT);
  pinMode(13, OUTPUT);
}

void loop() {
  float t_actual = smoothThermistor.temperature();

  Serial.print("t_objectivo:");
  Serial.print(t_objectivo);
  Serial.print(" ");
  Serial.print("t_actual:");
  Serial.println(t_actual);

  if (Serial.available() != 0) {
    float temp = Serial.parseFloat();
    if (temp > 0.0) t_objectivo = temp;
  }

  bool calentar = false;
  if (t_actual < t_objectivo) {
    calentar = true;
  } else {
    calentar = false;
  }
 
  digitalWrite(12, calentar);
  digitalWrite(13, calentar);
  delay(1000);
}