Notifications
Clear all

Libraries problem

8 Posts
3 Users
1 Likes
580 Views
Fritigern
(@fritigern)
Member
Joined: 2 years ago
Posts: 36
Topic starter  

I am wasting my life trying to test and use HC-SR04 ultrasound distance sensors work.

Months ago I followed the instructions in the Dronebot video and had no problems.

Since then I have upgraded my Mac to Monterey and run a virus check.

After about ten hours of troubleshooting ago the Arduino IDE will not compile the sketch due to missing files named (whatever).h.

My efforts yesterday resulted in the sketch reporting that is was spoilt for choice for libraries despite there being only the one with the exact name in the script or library. I have deleted all the Arduino programme and artefacts and started again with a clean install of Arduino 2.0.1.

I let it update the libraries and re-read the Dronebot instructions, which say

"The sketch requires three libraries, as the Adafruit DHT Library is dependent upon the Adafruit Universal Sensor Library. Both libraries can be installed using your Arduino IDE Library Manager."

 According to Library manager the thing that "Adafruit DHT Library" needs is Adafruit Unified Sensor. It was unable to install both together so I found The Adafruit "Unified Sensor Library" and idid it on its own. Except the dialogue does not change to "Installed", or "Uninstall" after each time I have installed it. It does show up in /Sketch/Include Library, however.

All of the installation was started using /Tools/manage Libraries then finished with /Sketch/Include Library.

Having installed the libraries required I'm still missing "NewPing.h" (and everything else it may reference).

I wasted loads of time copying code and then naming the new file and dropping it into the libraries directory only to find them then calling for libraries proper to Windows.

Could somebody tell me how I can get hold of individual library header files, or whether there is a resource that will let me search for a specific file like NewPing.h for my OS and download it.

Secondly, if I buy a sensor, how do I know what libraries it needs? How did Bill know he needed the Adafruit DHT libraries for his HC-SR04 and not some of the other thousands of libraries bearing the name HCSR04?

Please help, I'm tearing my hair out and am completely lost.

Thanks

Fritigern

 

 


   
Quote
Fritigern
(@fritigern)
Member
Joined: 2 years ago
Posts: 36
Topic starter  

First part solved. For the first time in many hours a google search for (missing library).h resulted in a site prepared to give me a zip file. Which worked.

All I need to do now is reinstall the other libraries I have deleted.

HOWEVER

I am still stuck with the question of how do I know what libraries I need BREFORE I start sketch writing?

Ta

Fritigern


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6512
 

@fritigern Library mismanagement can make you bald in a hurry for sure, you are not alone. I don't know why but some folks just naturally can't actually follow the instructions exactly. Now that you are back on track, as to the question about which of the many libraries to choose is from what I can tell a bit of a black art. Checking the usual sources is what I do, DBWS, Randomnerds, Swiss Guy. If I have a sample sketch from a source that didn't give library instructions I make a list of all the API names in the sample then using (on a MAC) finder, search my personal libraries .h files matching on each api in the list and enter that info in a spread sheet. Shortly one library will show it consistently has the hit. Delete all the rest and you are probably done. Good luck, if/when you have more specific questions come back.

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Fritigern
(@fritigern)
Member
Joined: 2 years ago
Posts: 36
Topic starter  

@zander 

Thank you for the steer and the resource names.

Fritigern


   
ReplyQuote
frogandtoad
(@frogandtoad)
Member
Joined: 5 years ago
Posts: 1458
 

@zander 

Posted by: @zander

@fritigern Library mismanagement can make you bald in a hurry for sure, you are not alone. I don't know why but some folks just naturally can't actually follow the instructions exactly.

When you're new... it takes some time before you realise that you need to do some study... we're all guilty of that 😉

Posted by: @zander

Now that you are back on track, as to the question about which of the many libraries to choose is from what I can tell a bit of a black art.

Maybe initially, though it's not a black art at all!

You just need to read the examples and research - You will find the answers if you are willing to do that, as I said earlier... it's just a learning experience we all go through at some point of our journey.

Posted by: @zander

Checking the usual sources is what I do, DBWS, Randomnerds, Swiss Guy.

Nothing wrong with checking those resources at all, but... your first point of checking should include the library designer/manufacturer for the utmost latest information on their library (MPU Examples), and most (if not all of them), have a dedicated github, site where you can read about the latest changes, etc.... to their library.

Posted by: @zander

Shortly one library will show it consistently has the hit. Delete all the rest and you are probably done. Good luck, if/when you have more specific questions come back.

I don't recommend this approach, as it really offers no basis on why you should do so, and may just break your Arduino development system entirely!  At minimum... take a backup/snapshot, whatever it takes to recover, should you have screwed something up.

Such issues are not deal breakers, and we can correct them quite eaisily without irrational panic, leading to a file system wiping cycle.

Not trying to be rude, but there are ways we can move forward and provide answers to these questions (simply by updating or downgrading libraries, we can resolve just about any issue).

Cheers


   
ReplyQuote
Fritigern
(@fritigern)
Member
Joined: 2 years ago
Posts: 36
Topic starter  

@frogandtoad

Thanks.

Fritigern


   
ReplyQuote
Ron
 Ron
(@zander)
Father of a miniature Wookie
Joined: 3 years ago
Posts: 6512
 

@fritigern So have you resolved your problem?

First computer 1959. Retired from my own computer company 2004.
Hardware - Expert in 1401, and 360, fairly knowledge in PC plus numerous MPU's and MCU's
Major Languages - Machine language, 360 Macro Assembler, Intel Assembler, PLI/1, Pascal, C plus numerous job control and scripting languages.
Sure you can learn to be a programmer, it will take the same amount of time for me to learn to be a Doctor.


   
ReplyQuote
Fritigern
(@fritigern)
Member
Joined: 2 years ago
Posts: 36
Topic starter  

@Ron,

Yes, thank you. The sketch-that-worked-before problem was solved by the edit to make it compatible with the updated libraries, and the rest is a matter of now knowing where to look.

Thanks

Fritrigern


   
Ron reacted
ReplyQuote