GithubHelp home page GithubHelp logo

rp2040pio-ds18b20's Introduction

RP2040PIO-DS18B20

Raspberry Pi PICO or RP2040 PIO Lib for DS18B20 Temperature Sensor

Based on code from Harry Fairhead (2021): "The Pico In C: A 1-Wire PIO Program".

Dependencies

Pico SDK dependencies only (GPIO and PIO)

Example

See main.cxx

Include in own projects

Simply include DS18B20pio.cmake in your CMakefile Then add ds18b20pio into target_link_libaries

Usage

Construct object:

DS18B20 ds = DS18B20(pio0, 7);

Giving the pio being used, I've only used pio0. And the GPIO number, in this case 7.

Trigger the device to sample with the command:

ds.convert();

Then give the divise approx 1000ms to complete that before reading the temperature with:

float temp = ds.getTermperature();

rp2040pio-ds18b20's People

Contributors

jondurrant avatar

Stargazers

 avatar Julien Kohler avatar  avatar  avatar

Watchers

 avatar

Forkers

flexxxman

rp2040pio-ds18b20's Issues

Problems building example

Hello, I'm having a couple of problems trying to build your example code for the RPi pico. I'm using Debian 11 and VS Code and am new to using CMake. So, I've made a folder under ~/pico/projects/ds1820 and copied your code (unmodified) to it. VS Code seems to do the configuration OK, but fails on the build with:-

[build] .../pico/projects/ds1820/src/main.cxx:4:10: fatal error: DS1820.pio.h: No such file or directory
[build] #include "DS1820.pio.h"

If I run build just on 'ds18p20pio_DS1820_pio_h' I can see that this missing header file has been generated in the 'build' subdir, but is obviously not being found by the main build. If I copy that header file (DS1820.pio.h) to the 'src' directory, then I get much further. It looks like all the compilation gets done, but then fails on linking:-

[build] [ 94%] Linking CXX executable DS18B20.elf
[build] /usr/lib/gcc/arm-none-eabi/8.3.1/../../../arm-none-eabi/bin/ld: cannot find -lds20b18pio
[build] collect2: error: ld returned 1 exit status

So 'ds20b18pio' doesn't seem to get created (I can't find this in any other location) but I'm struggling to find out why this is. Any pointers on how to track down the problem would be much appreciated.
Rgds,
DB

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.