Hola soy nuevo en Arduino y en este foro.
Estoy haciendo un proyecto de Arduino Mega con el sensor DHT11. La cosa es que todo funciona correctamente pero por algun motivo el Monitor Serie no muestra correctamente una tilde de una palabra y el simbolo de grado "°".
Lo curioso es que si me muestra esos caracteres correctamente despues intervalos irregulares donde se muestra mal. Adjunto una imagen para que veais de lo que hablo.
Tambien posteare el codigo de mi proyecto.
#include <DHT.h> // Esto se hace para agregar la libraría que tendrá el control del sensor
#define DHTPIN 2
#define DHTTYPE DHT11
DHT dht(DHTPIN, DHTTYPE);
int PinRojo = 9; // Red LED, connected to digital pin 11
int PinVerde = 11; // Green LED, connected to digital pin 10
int PinAzul = 10; // Blue LED, connected to digital pin 9
void setup() {
// Inicializamos comunicación serie
Serial.begin(9600);
// Comenzamos el sensor DHT
dht.begin();
pinMode(PinRojo, OUTPUT); // Sets the pins as output for RGB LED
pinMode(PinVerde, OUTPUT);
pinMode(PinAzul, OUTPUT);
}
void loop() {
// Esperamos 5 segundos entre medidas
delay(5000);
// Leemos la humedad relativa
float h = dht.readHumidity();
// Leemos la temperatura en grados centígrados (por defecto)
float t = dht.readTemperature();
// Comprobamos si ha habido algún error en la lectura
if (isnan(h) || isnan(t)) {
Serial.print("Error obteniendo los datos del sensor DHT11");
return;
}
// Calcular el índice de calor en grados centígrados
float hic = dht.computeHeatIndex(t, h);
Serial.print("Humedad: ");
Serial.print(h);
Serial.print(" %\t");
Serial.print("Temperatura: ");
Serial.print(t);
Serial.print(" °C ");
Serial.print("Índice de calor: ");
Serial.print(hic);
Serial.println(" °C ");
if(((t) < 26) && ((t) >= 23.2)) // Writing the LED colour pins HIGH or LOW to set colours
{
digitalWrite(PinRojo, HIGH); // yellow
digitalWrite(PinVerde, HIGH);
delay(100);
digitalWrite(PinAzul, LOW);
}
if(((t) < 23) && ((t) > 20.2))
{
digitalWrite(PinVerde, HIGH); // green
delay(100);
digitalWrite(PinRojo, LOW);
digitalWrite(PinAzul, LOW);
}
if(((t) < 20) && ((t) > 17.2))
{
digitalWrite(PinVerde, HIGH); // aqua
digitalWrite(PinAzul, HIGH);
delay(100);
digitalWrite(PinRojo, LOW);
}
if((t) <= 12)
{
digitalWrite(PinAzul, HIGH); // blue
delay(100);
digitalWrite(PinVerde, LOW);
digitalWrite(PinRojo, LOW);
}
delay(1000); // Sensor shouldn't be read too frequently so delay of 1s
}