Hello,
I write the following code but this stop to run after the Serial.println("A");
It displays A and return in my serial monitor, and after then nothing. Even if I put another println after this.
.h
#ifndef LCD_h
#define LCD_h
#include <LiquidCrystal_I2C.h>
class LCD{
public:
LCD(void);
void firstLine();
void secondLine(float tempInCelsius);
private:
LiquidCrystal_I2C lcd;
};
#endif
.cpp
#include "LCD.h"
#include <LiquidCrystal_I2C.h>
LCD::LCD(void) : lcd(0x27, 16, 2){
Serial.begin(9600);
Serial.println("A");
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
}
void LCD::secondLine(float tempInCelsius){
Serial.println("C");
lcd.clear();
lcd.setCursor(0, 1);
lcd.print("T = ");
lcd.print(tempInCelsius);
}
.ino
#include "LCD.h"
LCD CrystalLCD;
void setup(void)
{
// Serial.begin(9600);
Serial.println("B");
}
void loop(void)
{
float temp = 1.40;
CrystalLCD.secondLine(temp);
}