Arduino Uno: Missing Libraries

Advert

Arduino Uno: Missing Libraries

Home Forums Electronics in the Workshop Arduino Uno: Missing Libraries

Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #773349
    James Alford
    Participant
      @jamesalford67616

      A couple of years ago, I built a circuit to operate a clock, the circuit being triggered by events generated by an Arduino Uno. The circuit included a RTC and a LCD to display the time and three buttons to set the time. The thing worked perfectly for several days, so I unplugged everything and put it away.

      I pulled it out today, reassembled it, plugged it in and the thing seems to have died. The LCD displays a random time initially, but then starts to act like a counter, changing time rapidly more than once a second. None of the time setting buttons worked either. I checked the connections and all are sound. I also changed the battery in the RTC. The board is powered by a transformer.

      Suspecting that the code had become corrupted on the board, I tried to recompile the source code and reinstall it onto the board. However, when I tried to verify the code before uploading it, it failed, telling me that the following libraries are missing: event.h, timer.h and elapsedMillis.h.

      I tried to reinstall these, but they do not appear in the list of available libraries and I have no idea where I found them originally.

      Can anyone suggest a way around this, other than starting all over again?

      Thank you.

      James.

      Advert
      #773350
      John Haine
      Participant
        @johnhaine32865

        You could try putting  #include arduino.h right at the start of your source code, also perhaps reinstall the Arduino IDE which should bring a full set of libraries with it.

        #773352
        Stuart Smith 5
        Participant
          @stuartsmith5

          Have you tried to install via the ‘manage libraries’ option within the tools section of the Arduino IDE?

          Other than that ,you could try reinstalling the Arduino IDE.

           

          Stuart

          #773361
          James Alford
          Participant
            @jamesalford67616

            Thank you both for the suggestions which I shall try in the morning.

            James.

            #773421
            James Alford
            Participant
              @jamesalford67616

              Oh, well. Back to the drawing board. I tried these and recovered the elapsedMillis library, but the others remain elusive. I suspect that they came with some timer codes that I copied from an on-line project on which I based my code. Sadly,  the site from which I copied them is no longer working.

              Regards,

              James.

              #773433
              SillyOldDuffer
              Moderator
                @sillyoldduffer

                Before rushing to do a re-write, search the computer for the missing files.   Strictly speaking they are header files rather than libraries, but no need to split hairs!

                The problem may simply be that they are in the wrong place and the IDE’s compiler isn’t looking for them in those directories.   (Directory aka folder.)

                In C/C++  statements like #include <timer.h>  are common.  The <> brackets mean “look for this file in the compilers list of system directories”.   This is where installed external libraries and processor headers should be.   There are thousands of them.

                Alternatively, .h files written locally by a programmer are stored in a list of user defined directories.   They are identified by the quote marked form: #include “timer.h”    For simplicity In the Arduino IDE, local headers like “timer.h” should always be in the same directory as the .ino file.   The editor should open each in a tab.

                 

                How to Search

                In Linux or mac, I prefer to search from the command line with:  find ~ -name ‘event.h’ -print 2> /dev/null

                Or “find ~ -name ‘*.h’ -print 2> /dev/null”    note the * wildcard will list all header files.

                In Windows cmd.exe offers the less powerful dir command, so it may be easier to use file explorer.  Start explorer and navigate to your home directory.   Then type ctrl-s  or ctrl-f to open the search box.   Type the filename into the box and with luck Explorer will find it.  Fingers crossed, the missing header files are only misplaced and can be copied to the right directory, or their content pasted into a new file.

                Cause.  I guess the missing header files are the  #include “something.h” type?  If so, not often necessary on Arduino, making it easy to forget they exist.  If the project is copied later, say going from version 1 to version 2, or moving to a different machine, only the .ino is taken and the equally important .h files get left behind.  You can guess how I know!

                Dave

                 

                #773439
                James Alford
                Participant
                  @jamesalford67616

                  Thank you for the suggestion, Dave.

                  I have just had a quick search and found them lurking in an old folder, date from 2020, which is encouraging. I shall try to move them to the expected location this evening.

                  James.

                  #773440
                  Robert Atkinson 2
                  Participant
                    @robertatkinson2
                    On James Alford Said:

                    Oh, well. Back to the drawing board. I tried these and recovered the elapsedMillis library, but the others remain elusive. I suspect that they came with some timer codes that I copied from an on-line project on which I based my code. Sadly,  the site from which I copied them is no longer working.

                    Regards,

                    James.

                    Try putting the defunct website url into the internet archive Wayback Machine.
                    https://web.archive.org/

                    They may have captured it.

                    Robert.

                    #773447
                    James Alford
                    Participant
                      @jamesalford67616

                      Thank you, Rupert.

                      I knew that there was something like this, but I didn’t know its name. I shall have a look.

                      #773498
                      James Alford
                      Participant
                        @jamesalford67616

                        Well, good news and bad news.

                        The good news: I found an archived copy of the website that I used.

                        The bad news: sadly, the page with the code and libraries had not been archived; only the pages describing the code.

                        The good news: I found the missing libraries, lurking in an old folder as suggested, and copied them into the current location.

                        The bad news: the code still fails to compile, saying that the .h file is missing. Forcing the compiler to skip this only finds further, unrelated errors.

                        I do not know quite what had happened, but the combination of a new laptop and reinstalling the IDE on the new computer when I bought it seems to have caused major problems with code that worked previously.

                        Ho, hum. Think again.

                        Thank you all for the help.

                        Regards,

                        James.

                         

                         

                         

                         

                         

                        #773541
                        SillyOldDuffer
                        Moderator
                          @sillyoldduffer
                          On James Alford Said:


                          The good news: I found the missing libraries, lurking in an old folder as suggested, and copied them into the current location.

                          The bad news: the code still fails to compile, saying that the .h file is missing. Forcing the compiler to skip this only finds further, unrelated errors.

                          Can you post a screenshot of the directory listing, and where is the ‘current location’? Also a pic of the source code showing the #include statements.  I ask because the compiler is very fussy!

                          Quite likely the unrelated errors are related to the missing header file – programs depend on the foundations being all present and correct.

                          I do not know quite what had happened, but the combination of a new laptop and reinstalling the IDE on the new computer when I bought it seems to have caused major problems with code that worked previously.

                          Ho, hum. Think again.

                          If all else fails, at least you can print them out, sob.  Moving a multi-file program to a new is a bit tricky – the IDE  expects a disciplined structure and a copy is easy to mess up.

                           

                          Thank you all for the help.

                          Regards,

                          James.

                           

                           

                           

                           

                           

                          The problem is probably trivial, it’s just nailing exactly what it is that’s difficult!

                          🙁

                          Dave

                          #773581
                          James Alford
                          Participant
                            @jamesalford67616

                            Thank you, Dave.

                            This is where the libraries and the ino file sit:

                            Screenshot 2024-12-31 082537

                            These are the libraries: the event.h file is within the Timer-master folder.

                             

                            Screenshot 2024-12-31 082103

                            This is the code.

                            Screenshot 2024-12-31 083616

                            Regards,

                            James.

                            #773585
                            John Haine
                            Participant
                              @johnhaine32865

                              Looking back at your first post, the problem could be that the RTC (ds3231?) had lost its configuration when you changed the battery.  IIRC these have a wide range of programmable output frequency options so when powered up in its default state it may not be at the frequency you expect.

                              #773593
                              SillyOldDuffer
                              Moderator
                                @sillyoldduffer

                                Hi James, the screenshots have me flummoxed because they look correct.  Appears you’ve got the file and directory locations right, which is good, except it still doesn’t work!

                                I’ll have a look at how the Arduino IDE adds libraries to the compiler’s search list.   Might be done by the installer, in which case moving the libraries manually may may have missed a step.  May take a while, I’m unwell this morning.

                                If you fancy a go yourself, try setting the “Show verbose output during compile” tickbox, which is in  File->Preferences->Settings.   After that Verify the sketch and wade through the output looking for the library loads.   Comparing a successful #include with a unsuccessful #include may reveal the answer.   Unfortunately the log is huge, and written in techno-terse!   Look for lines containing the word library.

                                Might give the answer, but I have more hope that an internet search for “manually install Arduino library” will provide the answer – the missing step.

                                Just in case anyone reading this thinks Arduino is always this complicated, not so.  James has an unusual problem that’s forced us to open the bonnet and take the engine apart…    Rarely necessary!

                                Dave

                                 

                                #773604
                                James Alford
                                Participant
                                  @jamesalford67616

                                  Thank you John and Dave.

                                  I shall look at both of your suggestions, realistically tomorrow as we are off out shortly.

                                  I hope that you feel better soon, Dave.

                                  Regards,

                                  James

                                  #773846
                                  James Alford
                                  Participant
                                    @jamesalford67616

                                    Hello, again.

                                    I did some more investigation into the problem with my code, reinstalled the IDE, reverted to the version of the IDE that I used to write the code and searched again for the library that was installed, but that the compiler could not find. Still, frustratingly, to no avail.

                                    My son suggested pasting the code into ChatGPT to see whether that could find the problem. It found no errors in the code, but made suggestions, similar to those made on here. Again, to no avail.

                                    I then wrote my requirements long-hand and pasted them into ChatGPT. A few seconds later, it had written the code, explained how to connect the components required to make it work and given an explanation of how the code works. The code then complied seamlessly.

                                    I was impressed, but frustrated that I could not find the cause of the problem.

                                    Thank you for the help given here.

                                    James.

                                  Viewing 16 posts - 1 through 16 (of 16 total)
                                  • Please log in to reply to this topic. Registering is free and easy using the links on the menu at the top of this page.

                                  Advert

                                  Latest Replies

                                  Viewing 25 topics - 1 through 25 (of 25 total)
                                  Viewing 25 topics - 1 through 25 (of 25 total)

                                  View full reply list.

                                  Advert

                                  Newsletter Sign-up