# Cannot compile OneWire library examples (Raspberry Pi Zero)

**URL:** https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235
**Category:** Troubleshooting
**Created:** [May 29, 2017, 1:57am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235 "2017-05-29T01:57:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Splinter71](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Splinter71](https://community.particle.io/u/Splinter71)
#### Post date: [May 29, 2017, 1:57am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/1 "2017-05-29T01:57:37Z")

</div>

Hi there,

I am trying to test a DS18B20 temperature sensor through the OneWire interface - using Particle and a Raspberry Pi Zero.

I am consistently getting the following compilation errors when trying to use the the OneWire example ("DS18x20\_Temperature") from the community libraries.

> /workspace/lib/OneWire/src/OneWire.h:96:5: error: 'STM32\_Pin\_Info' does not name a type  
> STM32\_Pin\_Info\* PIN\_MAP = HAL\_Pin\_Map(); // Pointer required for highest access speed  
> /workspace/lib/OneWire/src/OneWire.h:99:7: error: 'PIN\_MAP' was not declared in this scope  
> PIN\_MAP[\_pin].gpio\_peripheral-\>BSRRH = PIN\_MAP[\_pin].gpio\_pin;  
> /workspace/lib/OneWire/src/OneWire.h:103:7: error: 'PIN\_MAP' was not declared in this scope  
> PIN\_MAP[\_pin].gpio\_peripheral-\>BSRRL = PIN\_MAP[\_pin].gpio\_pin;

Physical device : Raspberry Pi Zero W  
Particle-agent version : 0.2.4  
Developing using the web-based IDE on [Particle Web IDE](https://build.particle.io/build)

Note that I can successfully include, and use other community libraries (eg. #include "LiquidCrystal\_I2C\_Spark.h") However I am not having any luck with OneWire.

Any help would be appreciated.

Thanks,  
Andrew

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [May 29, 2017, 9:19am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/2 "2017-05-29T09:19:09Z")

</div>

Does `DS18B20` library build for you?

---

<div class="post-metadata">

### Author: ![Splinter71](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Splinter71](https://community.particle.io/u/Splinter71)
#### Post date: [May 29, 2017, 9:33am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/3 "2017-05-29T09:33:05Z")

</div>

Hi ScruffR, thanks for the reply. I get exactly the same errors when trying to build the DS18B20 library. Cheers, Andrew

---

<div class="post-metadata">

### Author: ![Splinter71](https://avatars.discourse-cdn.com/v4/letter/s/ecd19e/32.png) [@Splinter71](https://community.particle.io/u/Splinter71)
#### Post date: [May 31, 2017, 4:01am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/4 "2017-05-31T04:01:55Z")

</div>

Hi all, I gave up on getting the Particle libraries to work. Instead I started from scratch and found some working C++ code that reads the DS18B20 sensors. [https://github.com/TeraHz/DS18B20](https://github.com/TeraHz/DS18B20)  
I simply created my own versions in Particle and copied the DS18B20.h and DS18B20.cpp file contents into the IDE. It was then simply a matter of taking snippets from the DS18B20Test.cpp file and adding this into my Particle project. Worked first time!

```auto
// This #include statement was automatically added by the Particle IDE.
#include <iostream>
#include <string>
#include "DS18B20.h"
using namespace std;

char w1_address[16];

void setup() {

    Particle.publish("setup", "start", PRIVATE);

    strcpy(w1_address, "28-0416947b6dff");

}

void loop() {

    DS18B20 w1Device1 (w1_address);
    
    double tempNow;
    tempNow = w1Device1.getTemp();
    
    Particle.publish("loop", String(tempNow), PRIVATE);

    delay(5000);
}

```

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [May 31, 2017, 8:05pm UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/5 "2017-05-31T20:05:03Z")

</div>

Good to know 👍

I had raised the question about the `OneWire` lib an RPi support behind the scenes, but haven’t had any official response yet - so sorry for not reporting back 😊

---

<div class="post-metadata">

### Author: ![vasekj](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@vasekj](https://community.particle.io/u/vasekj)
#### Post date: [September 4, 2019, 11:12am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/6 "2019-09-04T11:12:35Z")

</div>

Hi how you import your own created library into WEB IDE? I was not able to find way how to use any other library than listed. I am solving the same issue. Training to get up and running two DS18B20 sensors on Raspberry. No working library listed. All have issue during compilation.  
Thank you for you help  
J.

---

<div class="post-metadata">

### Author: ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)
#### Post date: [September 4, 2019, 11:23am UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/7 "2019-09-04T11:23:41Z")

</div>

In order to upload and publish it as a library, you should use CLI `particle library create` to get the structure of a valid library. Then distribute the files as needed (sources in `src` , examples in `examples/<exampleName>` , adapt the respective entries in `library.properties` (especially set the `URL` and `repository` fields to point to your GitHub repo) and then run `particle library upload` to upload the library as _private_ to test whether all examples can be used as expected and once the tests are successful run `particle library publish` to make it public.

---

<div class="post-metadata">

### Author: ![vasekj](https://avatars.discourse-cdn.com/v4/letter/v/d6d6ee/32.png) [@vasekj](https://community.particle.io/u/vasekj)
#### Post date: [September 4, 2019, 6:32pm UTC](https://community.particle.io/t/cannot-compile-onewire-library-examples-raspberry-pi-zero/33235/8 "2019-09-04T18:32:47Z")

</div>

thank you
