Arduino sketch does not compile anymore - Page 1
Forum section: electronics / general

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 10, 2025, 05:35:53 pm
content: 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 selectedArduino Nano.I also reassigned theSketchbook location, where the library's are. The typical c:\Users\...\Documents\Arduino\librariesBut the compiler prompts:fatal error: LiquidCrystal_I2C.h: No such file or directoryI have no idea, what I make wrong.It seems like an easy task beforehandAny help is very welcome.

author: ledtester
author_rank: Super Contributor
timestamp: February 10, 2025, 06:05:11 pm
content: 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?

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 11, 2025, 06:33:54 am
content: 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-folderThis is the error code:Code: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 providedexit status 1Compilation error: no matching function for call to 'LiquidCrystal_I2C::begin()'May I post the whole sketch?

author: WattsThat
author_rank: Frequent Contributor
timestamp: February 11, 2025, 07:07:36 am
content: 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\…

author: ledtester
author_rank: Super Contributor
timestamp: February 11, 2025, 07:22:40 am
content: Quote from: PSR B1257 on February 11, 2025, 06:33:54 amI 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_I2Cand then uploading it as a Custom library.I did this and was able to compile a program for the Nano using the Brabander library.

author: Lindley
author_rank: Regular Contributor
timestamp: February 11, 2025, 10:57:59 am
content: Quote from: PSR B1257 on February 11, 2025, 06:33:54 amYes, why not, we have the Adruino ide running, easy enough to test, just .zip the file and attach.

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 11, 2025, 11:44:17 am
content: QuoteBecause I (re)installed the LiquidCrystal_I2C library again because it was shown as not installed in the library-manager.QuoteI did not changed, just reassigned the same folder.QuoteSounds 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

author: Lindley
author_rank: Regular Contributor
timestamp: February 11, 2025, 01:07:30 pm
content: 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.

author: Ian.M
author_rank: Super Contributor
timestamp: February 11, 2025, 02:51:10 pm
content: Didn't you notice the warning:Quote(which I have hilited), when you installed the LiquidCrystal_I2C library?Frank de Brabander'soriginal Arduino-LiquidCrystal-I2C-librarydid 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 . . .

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 11, 2025, 05:26:51 pm
content: QuoteNo, since (again) it has worked before.QuoteThank you! Now the IDE is compiling the sketch. Unbelievable, would have never guessed it.Theonlyremaining problem is, the program is not working correctlyThe 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.QuoteClairvoyantThat makes it a bit better

author: tooki
author_rank: Super Contributor
timestamp: February 11, 2025, 07:02:31 pm
content: 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, Ihighlysuggest 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 severalincompatible, identically-named libraries from different authorsyou used! (I speak from experience...)

author: Ian.M
author_rank: Super Contributor
timestamp: February 12, 2025, 12:06:34 am
content: Yep, and while you are writing 'boilerplate' comments at the top of your sketch, also note the MCU and board name.

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 12, 2025, 07:59:49 am
content: QuoteYou're right, I should have done this.QuoteI'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 canCode:lcd.print("Pulsbreite=");only print "P" on the LCD?

author: Atlan
author_rank: Frequent Contributor
timestamp: February 12, 2025, 01:35:45 pm
content: Copy the libraries to your project directory and link them via "xxx" to avoid many problems.

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 12, 2025, 03:14:04 pm
content: QuoteCan't really follow you here. Will try to do this on the next project.Good news. The program is finally workingagainI 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

author: Atlan
author_rank: Frequent Contributor
timestamp: February 13, 2025, 05:31:49 pm
content: 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"

author: tooki
author_rank: Super Contributor
timestamp: February 14, 2025, 01:08:59 pm
content: Quote from: PSR B1257 on February 12, 2025, 03:14:04 pmBecause 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.

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 15, 2025, 10:06:37 am
content: QuoteThank you. Now that you say it, I remember once read about this optionQuoteEvidentlyQuoteWho knows... I tried (as mentioned above) the library suggested by@Lindleywhere the lcd.print command not even worked correctly (in my sketch anyway).

author: Ian.M
author_rank: Super Contributor
timestamp: February 15, 2025, 11:03:30 am
content: 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'sExtensible 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!

author: PSR B1257
author_rank: Frequent Contributor
timestamp: February 16, 2025, 12:06:22 pm
content: QuoteYes, with no success (hence Clairvoyant)QuoteSounds good, will give it a try.