Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
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.
1 Answer
7 years, 6 months ago.
Hello Harish,
To answer your question could you please provide a bit more details?
- Which
.bldfile would you like to import? (Do you mean thembed.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_Helloexample program into the online compiler by clicking on the orangeImport into Compilerbutton located in the top-right corner. - In the online compiler select the
DISCO-L072CZ-LRWAN1board as target platform (using the button located in the top-ritht corner). - Click on the
Compilebutton 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.
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 01 Jun 2018
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
- Open the
- Click on the
posted by Zoltan Hudak 01 Jun 2018On the toolbar click on the
Newbutton and selectNew Program...Select
DISCO-L072CZ-LRWAN1as Platform,Basic example how to control LEDs and user buttonas Template,DS1820_Test01as Program Name, keepUpdate this program and libraries to latest revisionchecked and click on theOKbutton.Importbutton and proceed to theLibrariestab. TypeDS1820into the search box and click on theSerachbutton. Then select theDS1820library listed on line #11 (Author: Zoltan Hudak) by clicking on it with mouse. Then click on theImport!button located in the top-right corner. Make sure you are importing it as library and click on theImportbutton when asked.main.cppfile in theDS1820_Helloprogram. Select all text by pressing Ctrl+a and then press Ctrl+c for copying. Then open temain.cppfile in the recently createdDS1820_Test01program. Select all text by pressing Ctrl+a and then press Ctrl+v to paste the code copied from theDS1820_Helloprogram.Compilebutton to build the birany.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 2018Hi 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 2018Hi 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