Author Topic: Arduino sketch does not compile anymore  (Read 4470 times)

0 Members and 2 Guests are viewing this topic.

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Arduino sketch does not compile anymore
« on: February 10, 2025, 05:35:53 pm »
Hi guys,
after some years, I wanted to program an Arduino again. Back in the day, the sketch worked fine, but today it will not even compile (with no changes to the code itself)  :-//

To make matters worse, I'm not even 100% sure, which board I have to select. It is a "Joyit Arduino Nano V3", so I selected Arduino Nano.

I also reassigned the Sketchbook location, where the library's are. The typical c:\Users\...\Documents\Arduino\libraries


But the compiler prompts: fatal error: LiquidCrystal_I2C.h: No such file or directory

I have no idea, what I make wrong.
It seems like an easy task beforehand  :)
Any help is very welcome.
« Last Edit: February 10, 2025, 05:38:46 pm by PSR B1257 »
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3987
  • Country: us
Re: Arduino sketch does not compile anymore
« Reply #1 on: February 10, 2025, 06:05:11 pm »
You shouldn't have to change the sketchbook location.

What does the library manager say?

I.e. go to Tools -> Manage Libraries and search for "liquidcrystal_i2c". Do you have the library by Frank de Brabander installed?


 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #2 on: February 11, 2025, 06:33:54 am »
Gosh...for some reason, this library was not stated as installed. I didn't even checked this before.

After installing it still does not compile and a new library-folder was created within the existing library-folder  :-//


This is the error code:
Code: [Select]
E:\...ino: In function 'void setup()':
E:\....ino:37:13: error: no matching function for call to 'LiquidCrystal_I2C::begin()'
   lcd.begin();
             ^
In file included from E:\...ino:2:0:
c:\Users\...\Documents\Arduino\libraries\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note: candidate: void LiquidCrystal_I2C::begin(uint8_t, uint8_t, uint8_t)
   void begin(uint8_t cols, uint8_t rows, uint8_t charsize = LCD_5x8DOTS );
        ^~~~~
c:\Users\...\Documents\Arduino\libraries\libraries\LiquidCrystal_I2C/LiquidCrystal_I2C.h:58:8: note:   candidate expects 3 arguments, 0 provided

exit status 1

Compilation error: no matching function for call to 'LiquidCrystal_I2C::begin()'

May I post the whole sketch?
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline WattsThat

  • Frequent Contributor
  • **
  • Posts: 910
  • Country: us
Re: Arduino sketch does not compile anymore
« Reply #3 on: February 11, 2025, 07:07:36 am »
I don’t think the full sketch will help, apparently there is still no I2C library.

Why do you now have nested directories? …\libraries\libraries\…
 

Online ledtester

  • Super Contributor
  • ***
  • Posts: 3987
  • Country: us
Re: Arduino sketch does not compile anymore
« Reply #4 on: February 11, 2025, 07:22:40 am »
Gosh...for some reason, this library was not stated as installed. I didn't even checked this before.

After installing it still does not compile and a new library-folder was created within the existing library-folder  :-//

I think that's because you changed the sketchbook location.

Can you just start over with a fresh install of the Arduino IDE?


Update:

Another option is to use the Arduino Cloud IDE: https://cloud.arduino.cc/

It doesn't have the LCDCrystal_I2C library installed but there are two options:

- use the LCD_I2C library instead -- seems to be very similar
- you can upload the Frank de Brabander library by first downloading the zip file from Github:

https://github.com/johnrickman/LiquidCrystal_I2C

and then uploading it as a Custom library.

I did this and was able to compile a program for the Nano using the Brabander library.
« Last Edit: February 11, 2025, 07:49:16 am by ledtester »
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 237
  • Country: gb
Re: Arduino sketch does not compile anymore
« Reply #5 on: February 11, 2025, 10:57:59 am »


May I post the whole sketch?

Yes, why not, we have the Adruino ide running, easy enough to test, just .zip the file and attach.
 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #6 on: February 11, 2025, 11:44:17 am »
Quote
Why do you now have nested directories? …\libraries\libraries\…
Because I (re)installed the LiquidCrystal_I2C library again because it was shown as not installed in the library-manager.

Quote
I think that's because you changed the sketchbook location.
I did not changed, just reassigned the same folder.

Quote
why not, we have the Adruino ide running, easy enough to test,
Sounds good. Even though it has to work, since it has worked in the past.

I did not reinstalled the Arduino-IDE (jet) but updated to 2.3.4 with the same result  :--
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline Lindley

  • Regular Contributor
  • *
  • Posts: 237
  • Country: gb
Re: Arduino sketch does not compile anymore
« Reply #7 on: February 11, 2025, 01:07:30 pm »
Hi,

Got it to compile ok using this library and changing the lcd.begin to lcd.init. 

So delete any other LQ I2c libraries you have an install this one.

Try on your hadware to ensure it actually works correctly.





 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14084
Re: Arduino sketch does not compile anymore
« Reply #8 on: February 11, 2025, 02:51:10 pm »
Didn't you notice the warning:
Quote
LiquidCrystal I2C
by Frank de Brabander
A library for I2C LCD displays.
The library allows to control I2C displays with functions extremely similar to LiquidCrystal library. THIS LIBRARY MIGHT NOT BE COMPATIBLE WITH EXISTING SKETCHES.
(which I have hilited), when you installed the LiquidCrystal_I2C library?

Frank de Brabander's original Arduino-LiquidCrystal-I2C-library did not take any parameters for its  begin() method as they were all specified when you declared the I2C LCD object.  (See examples in the GitHub repo.)  However the more recent version of LiquidCrystal_I2C, installed from the library manager expects you to either provide begin() with cols, rows to match your display size (and optionally with an extra parameter that selects the character size for single line 5x10 character matrix displays), or to use the init() method, as Lindley has suggested above.

Caution: you may find other incompatibilities . . .
 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #9 on: February 11, 2025, 05:26:51 pm »
Quote
Didn't you notice the warning:
No, since (again) it has worked before.

Quote
Try on your hadware to ensure it actually works correctly.
Thank you! Now the IDE is compiling the sketch. Unbelievable, would have never guessed it.

The only remaining problem is, the program is not working correctly  :-BROKE
The print-commands of line 40 and 42 only gives the first letter.
Adjusting of the pulse width and frequency doesent work.
I also get no output at the pwm-pin, so it is not just the LCD which shows wrong characters.

Quote
Caution: you may find other incompatibilities . . .
Clairvoyant That makes it a bit better :-+
« Last Edit: February 11, 2025, 05:39:35 pm by PSR B1257 »
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15541
  • Country: ch
Re: Arduino sketch does not compile anymore
« Reply #10 on: February 11, 2025, 07:02:31 pm »
For what it's worth, library management (or lack thereof) is one of the Arduino IDE's biggest downsides. Having to install libraries globally is just silly.

If you're willing to climb the slight learning curve, I highly suggest using PlatformIO instead, as it allows not only per-project libraries, but even lets you specify specific versions of libraries to projects. If you do this for every library (and framework and board packages) it means it'll always just compile, even years later.

If you stick with Arduino IDE, I highly suggest always specifying the exact libraries used (by name of author, URL, etc) so you can find them later. If you don't do this, you can end up not knowing which of several incompatible, identically-named libraries from different authors you used! (I speak from experience...)
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14084
Re: Arduino sketch does not compile anymore
« Reply #11 on: February 12, 2025, 12:06:34 am »
Yep, and while you are writing 'boilerplate' comments at the top of your sketch, also note the MCU and board name.
 
The following users thanked this post: tooki

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #12 on: February 12, 2025, 07:59:49 am »
Quote
also note the MCU and board name.
You're right, I should have done this.

Quote
I highly suggest always specifying the exact libraries used (by name of author, URL, etc) so you can find them later.
I've only ever had this one LCD-library (also for other sketches) installed.

I was mistaken, the output does work but with the not correct working LCD it was not obvious, what the program was set to. 
That's a good sign, i guess/hope.

How can
Code: [Select]
lcd.print("Pulsbreite=");only print "P" on the LCD?
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline Atlan

  • Super Contributor
  • ***
  • Posts: 1040
  • Country: sk
Re: Arduino sketch does not compile anymore
« Reply #13 on: February 12, 2025, 01:35:45 pm »
Copy the libraries to your project directory and link them via "xxx" to avoid many problems.
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #14 on: February 12, 2025, 03:14:04 pm »
Quote
link them via "xxx"
Can't really follow you here. Will try to do this on the next project.

Good news. The program is finally working again :-+
I ended up just trying different LCD-library's until I found one which worked. This happened to be "LiquidCrystal_I2C_Hangul" by Junwha Hong. No idea, why they are a gazillion LCD-library's anyway ... nuts  :o
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline Atlan

  • Super Contributor
  • ***
  • Posts: 1040
  • Country: sk
Re: Arduino sketch does not compile anymore
« Reply #15 on: February 13, 2025, 05:31:49 pm »
Now you have it like this #include <LiquidCrystal_I2C_Hangul> copy the library to the folder where you have your project, it will contain .h and .c files, and write #include "LiquidCrystal_I2C_Hangul"
FNIRSI 1013D Always provide a picture or video with the problem where the parameters of the oscilloscope are visible, and a picture of the diagnostic screen with the values.
Firmware is here (or not) https://github.com/Atlan4/Fnirsi1013D/tree/main/Guide%20to%20firmware
 

Offline tooki

  • Super Contributor
  • ***
  • Posts: 15541
  • Country: ch
Re: Arduino sketch does not compile anymore
« Reply #16 on: February 14, 2025, 01:08:59 pm »
Quote
link them via "xxx"
Can't really follow you here. Will try to do this on the next project.

Good news. The program is finally working again :-+
I ended up just trying different LCD-library's until I found one which worked. This happened to be "LiquidCrystal_I2C_Hangul" by Junwha Hong. No idea, why they are a gazillion LCD-library's anyway ... nuts  :o
Because anyone can create a library (or modify an existing one) and distribute it. Hangul is the Korean alphabet, so my guess is that library is modified to support Korean.
 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #17 on: February 15, 2025, 10:06:37 am »
Quote
copy the library to the folder where you have your project, it will contain .h and .c files, and write #include "LiquidCrystal_I2C_Hangul"
Thank you. Now that you say it, I remember once read about this option  :palm:

Quote
Because anyone can create a library
Evidently ;D

Quote
so my guess is that library is modified to support Korean.
Who knows... I tried (as mentioned above) the library suggested by @Lindley where the lcd.print command not even worked correctly (in my sketch anyway).
In theory, there is no difference between theory and practice. But, in practice, there is.
 

Offline Ian.M

  • Super Contributor
  • ***
  • Posts: 14084
Re: Arduino sketch does not compile anymore
« Reply #18 on: February 15, 2025, 11:03:30 am »
Did you try going back to the old version of Frank de Brabander's LiquidCrystal_I2C I linked in reply #8 above?  You'd need to install it manually, preferably by copying the .cpp and .h files to your sketch folder, and change the #include to use " " instead of < >, so that it is only used for that particular sketch.

Going forward, when writing new sketches, I strongly recommend Bill Perry's Extensible hd44780 LCD Library, which handles character LCDs with a variety of hardware interfaces, including I2C and also direct connection, because my experience is it 'just works'*.   Once initialised, its functionally LiquidCrystal compatible so is easy to port sketches to.  The down-side is it typically takes approx. 2K more program memory than LiquidCrystal_I2C.


* Unless you've got a hardware fault - I wasted *DAYS* troubleshooting an 8x2 I2C LCD that wouldn't print anything in its last two columns, till I realised the edge of the LCD glass was chipped and part of the zebra strip wasn't making contact!
« Last Edit: February 15, 2025, 11:14:57 am by Ian.M »
 

Offline PSR B1257Topic starter

  • Frequent Contributor
  • **
  • Posts: 344
  • Country: de
Re: Arduino sketch does not compile anymore
« Reply #19 on: February 16, 2025, 12:06:22 pm »
Quote
Did you try going back to the old version of Frank de Brabander's LiquidCrystal_I2C I linked in reply #8 above?
Yes, with no success (hence Clairvoyant  :) )

Quote
Going forward, when writing new sketches, I strongly recommend Bill Perry's Extensible hd44780 LCD Library,
Sounds good, will give it a try.

In theory, there is no difference between theory and practice. But, in practice, there is.
 
The following users thanked this post: Ian.M


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf