Create Editor using incorrect library

I am trying to include the library DS18B20 (v1.0.0) in my code but when I try to compile it, it uses the wrong library despite me favouriting the correct one. Any suggestions how to force it to use the correct one?

The compiler error is as follows:

Multiple libraries were found for "DS18B20.h"
Used: /home/builder/opt/libraries/latest/ds18b20_rt_0_1_7
Not used: /home/builder/opt/libraries/latest/onewirehub_2_2_1
Not used: /home/builder/opt/libraries/latest/maximwire_1_0_2
Not used: /home/builder/opt/libraries/latest/ds18b20_1_0_0
Multiple libraries were found for "OneWire.h"
Used: /home/builder/opt/libraries/latest/onewire_2_3_5
Not used: /home/builder/opt/libraries/latest/sdu_ags_sensorboard_1_0_0
Not used: /home/builder/opt/libraries/latest/max31850_onewire_1_1_0
Using library SNU at version 1.0.2 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.8.9/libraries/SNU
Using library SPI at version 1.0 in folder: /home/builder/.arduino15/packages/arduino/hardware/samd/1.8.9/libraries/SPI
/tmp/972259600/Temperature_monitor_feb05a/Temperature_monitor_feb05a.ino:3:13: error: invalid conversion from 'int' to 'OneWire*' [-fpermissive]
DS18B20 ds(2); // temperature sensor onewire data pin D2

Unfortunately, favoriting doesn't have any impact on which library gets priority.

Although there are several possible techniques that can be used to influence Arduino Web Editor to pick the library you want (see this if you're interested in learning about all of them), in this case only one of them is usable. But that's fine, we only need one!

The solution is to import the library you want to use. Imported libraries are given preference over the pre-installed libraries (see this if you're interested in the full details).

  1. From the menu on the left side of the Arduino Web Editor window, click "Libraries".
  2. Click the "Library Manager" button.
  3. Search for "DS18B20".
  4. If the star to the right of the library is not already filled, click the star to add the library to your "Favorites" (I know you said you already did this, but I want to provide the complete instructions in case they might be useful to others).
  5. Click the "Done" button.
  6. From the "Libraries" pane of the Arduino Web Editor window, click the "Favorites" tab.
  7. Find "DS18B20" in the list of favorite libraries and hover the mouse pointer over "DS18B20".
  8. Click the downward pointing triangle to the right of "DS18B20". This will open a dropdown menu,
  9. From the menu, click "Download Library".
  10. Click the upward pointing arrow button ("Import") to the right side of the "Library Manager" button.
  11. If you get a popup about importing your sketchbook, click the "Import" button.
  12. Select the downloaded library file (
  13. Click the "Open" button.
  14. Wait for Arduino Web Editor to display the notification that the library was successfully imported.
  15. Click the "OK" button.

This will cause the version of the library you imported to always be used by all sketches (1.0.0 in this case), so you may want to occasionally check to see if the library author has released a new version of the library and repeat the process with the new version in order to take advantage of any improvements or bug fixes that have been made to the library in the new release.

This general technique can be applied to any library, it's not specific to the DS18B20.


Worked perfectly, thanks for the very quick reply.

You're welcome. I'm glad to hear it's working now. Enjoy!

importing Onewire.h solved the "serial port disappearing after upload" problem! Thank you.

  • regarding DS18B20 on Nano IoT, onewire.h and DallasTemperature.h upload bug using web editor.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.