This is a link to the guy that made the project work, it seems that I'm unable to make it work by myself: the project.
What am I doing wrong?
/* DICTIONARY - CC = ConClusion ; */
/* LEGEND - Serial legend - */
/* README - */
#define TRIG 7
#define ECHO 8
#define PB_1 2
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x27,16,2);
uint32_t loop_count = 0;
long duration;
int distance;
volatile byte LCD_State = 0;
unsigned long lastChange;
void setup()
{
pinMode(TRIG,OUTPUT);
pinMode(ECHO,INPUT);
Serial.begin(115200);
attachInterrupt(digitalPinToInterrupt(PB_1),LCD_to_ON,RISING);
lcd.begin();
lcd.backlight();
}
void loop()
{
loop_count++;
if (LCD_State == 1 && (millis() - lastChange) >= 600000/*time corresponding to LCD Screens ON-time, CC=changable*/ )
{
LCD_State = 0;
}
Serial.print(loop_count);
Serial.print(" ");
Serial.print(":");
Serial.print(" ");
digitalWrite(TRIG, LOW);
delayMicroseconds(2);
digitalWrite(TRIG, HIGH);
delayMicroseconds(10);
digitalWrite(TRIG, LOW);
duration = pulseIn(ECHO, HIGH);
distance = duration * 0.034 / 2;
Serial.print(distance);
Serial.print(" ");
if(LCD_State == 0)
{
Serial.print(LCD_State);
}
else if(LCD_State == 1)
{
Serial.print(LCD_State);
}
Serial.print(" ");
Serial.print(millis());
Serial.print(" ");
Serial.print(lastChange);
Serial.print(" ");
if(LCD_State == 1)
{
Serial.print("OK, L_ON");
}
else if(LCD_State == 0)
{
Serial.print("OK, L_OFF");
}
Serial.println();
delay(10);//Just for the TINKERCAD, remove from hardware-based version
}
void LCD_to_ON()
{
LCD_State = 1;
lastChange = millis();
}
Error:
invalid header file
How the SM output should look with LCD without I2C:
Ancillary information
(unimportant to the issue)
BTW the code is for measuring water level and displaying it on the display. After I buy the hardware and when it finally ships, I will add a lot more (requiring MEGA2560 or even DUE)-
More complex: It will measure the water level and the temp of the surroundings(maybe even the water itself). It will turn on/off the Water pump using my fathers scheme for turning big relay on/off with two buttons but instead of buttons I will use smaller relays for automatization.I will insure that it doesnt malfunction with the arduino-off state being 0 for the pump and 2 pairs of electrodes or sum mounted on the top of the water tank.- when they complete the circuit because of unpredicted water level the program will stop the pump. I will need to measure and convert the readings like 60 times(add x liters of water = y meter increase) because the water tank is positioned horizontally so the calculations would be difficult. I will need to create a website or sum and send the data to it -(W5500) , log of time-(RTC DS3231 I2C ). Plus alot more.
If I find no solution I will probably have to start programming it raw earlier than I expected, It's just that everyday I find better components and more to use in my project, i will either wait and order once || not wait and order multiple times. And with that all I'm sure I will still probably regret my purchases




LiquidCrystal_I2C.hfile? Do you haveLiquidCrystal_I2Clibrary installed? What happens if you try to compile it in the Arduino IDE, as a sanity check? FWIW, the "invalid header file" response is a generic response to a function call or constructor in your sketch not matching what's in a library's header file. So you are probably calling something inLiquidCrystal_I2Cincorrectly.void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );invalid header file