7 years, 6 months ago.

Need a code for DS18B20 1-wire Temperature sensor on STM32l072Disco.

Hi Everyone, I am new to this Environment.So I am finding many difficulties to find tutorials. And could anyone say me how to import the .bld file in existing program ? And if someone has a code for it,could you please post it here ? It will be really helpful.

Thank you in Advance.

Hello Harish,

I seems that something was corrupted on the MBED online compiler side. So try the following:

  • Create a new DS1820_Test01 program:
    On the toolbar click on the New button and select New Program...
    Select DISCO-L072CZ-LRWAN1 as Platform, Basic example how to control LEDs and user button as Template, DS1820_Test01 as Program Name, keep Update this program and libraries to latest revision checked and click on the OK button.
  • On the toolbar click on the Import button and proceed to the Libraries tab. Type DS1820 into the search box and click on the Serach button. Then select the DS1820 library listed on line #11 (Author: Zoltan Hudak) by clicking on it with mouse. Then click on the Import! button located in the top-right corner. Make sure you are importing it as library and click on the Import button when asked.
  • Open the main.cpp file in the DS1820_Hello program. Select all text by pressing Ctrl+a and then press Ctrl+c for copying. Then open te main.cpp file in the recently created DS1820_Test01 program. Select all text by pressing Ctrl+a and then press Ctrl+v to paste the code copied from the DS1820_Hello program.
  • Click on the Compile button to build the birany.
posted by Zoltan Hudak 01 Jun 2018

Hi Zoltan ! Thank you so much for your reply ! Sorry for late reply, I had some issues in my laptop. I have tried the following steps, it's compiling now. I have some doubts here, please try to help me if you can. 1.But is DS1820_Hello program is enough to calculate the temperature ? 2.Now the same problem occurs for every program, for example I am trying to compile LoRaWAN-demo-72 program, but it showing the same error "Error: Target "DISCO_L072CZ_LRWAN1" is not recognized". Could you help me for these two steps ?

Thank you in Advance Harish

posted by Harish Kumar Bringi Ramakannu 09 Jun 2018

Hi Zoltan ! Thank you so much for your reply ! Sorry for late reply,because I had some issues in my laptop. I have tried the following steps, it's compiling now. I have some doubts here, please try to help me if you can. 1.But is DS1820_Hello program is enough to calculate the temperature ? 2.Now the same problem occurs for every program, for example I am trying to compile LoRaWAN-demo-72 program, but it showing the same error "Error: Target "DISCO_L072CZ_LRWAN1" is not recognized". Could you help me for these two steps ?

Thank you in Advance Harish

posted by Harish Kumar Bringi Ramakannu 09 Jun 2018

Hi Zoltan, I am using DS18B20 sensor. Is it same as DS1820 sensor ? Because I have checked in intrnet, it was not same. How can I run the code for DS1820 for DS18B20 if it is not the same ?

posted by Harish Kumar Bringi Ramakannu 11 Jun 2018

1 Answer

7 years, 6 months ago.

Hello Harish,

To answer your question could you please provide a bit more details?

  • Which .bld file would you like to import? (Do you mean the mbed.bld?)
  • Where is the existing program located? (In the online compiler?)

The following steps could help you get started reading a DS18B20 sensor:

  • Open this page and import the DS1820_Hello example program into the online compiler by clicking on the orange Import into Compiler button located in the top-right corner.
  • In the online compiler select the DISCO-L072CZ-LRWAN1 board as target platform (using the button located in the top-ritht corner).
  • Click on the Compile button on the toolbar and save the binary file to the mbed virtual disk.
  • Do not forget to connect a 4k7 resistor between the DS18B20 data pin and the +3.3V rail.

Accepted Answer

Hi Zoltan, Thanks a lot. I tried everything before. But it shows as my device (Error: Target "DISCO_L072CZ_LRWAN1" is not recognized). Though even I selected the platform correctly. But it doesn't work to me. Do you know what to do with this error ? And for your questions , if I go to help in my error, the solution shows like this, Compiler Error 0 ""/extras/mbed_5e5da4a5990b/LPC1768/ARM/LPC1768.sct", line 4 (column 9): Error: L6235E: More than one section matches selector - cannot all be FIRST/LAST." in file "/"

Look for multiple mbed.bld files in your program.

Thank you in Advance !

posted by Harish Kumar Bringi Ramakannu 01 Jun 2018