Giter Club home page Giter Club logo

ds18b20-photon's Introduction

#DS18B20 Library for Particle Core, Photon and P1 Modified DS18BXX Lib copied from https://github.com/krvarma/Dallas_DS18B20_SparkCore Sample application using Particle Photon and Dallas DS18B20 Digital Temperature Sensor. The OneWire source code is taken from this link by @tidwelltimj. I just separated this into two classes OneWire and DS18B20. The sample code publishes a variable named tmpinfo with temperature value.

Requires Particle-OneWire (included) from https://github.com/balbano/OneWire-Particle/tree/master/firmware Wiring: Power to 3.3/5V GND to GND Signal to D2 (with 4.7k pullup resistor)

Use crcCheck() to verify the sensor was successfully read.

ds18b20-photon's People

Contributors

ericyuanyong avatar jenesaisdiq avatar lukeusmc avatar rafiki270 avatar scruffr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

ds18b20-photon's Issues

redefinition of 'class DS18B20'

Veryfing code using this library in Particle Build fails with this error ONLY WHEN COMPILING FOR SPARK CORE

DS18B20/DS18B20.h:15:7: error: redefinition of 'class DS18B20'
 class DS18B20{
       ^

P1 Support

In file included from DS18B20/DS18B20.h:1:0,
from measuredisplayt.cpp:5:
This looks like an error in DS18B20 library.

DS18B20/Particle-OneWire.h:125:6: error: #error "*** PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon _"
#error "
_ PLATFORM_ID not supported by this library. PLATFORM should be Core or Photon ***"

I am using the SparkFun Photon RedBoard (P1).

Memory leak when reinstatiating sensor object

As I found out here, there is a potential memory leak when using multiple instances of that library
https://community.particle.io/t/ds18b20-switching-pins-during-execution/25727/15

This is easily fixed with the intrdocution of a destructor

DS18B20::~DS18B20() {
    delete(ds);
}

And if you're at it, could you also replace these macros, please?

  • digitalWriteFastHigh()
  • digitalWriteFastLow()
  • digitalReadFast()

with the now available functions

  • pinSetFast(_pin)
  • pinResetFast(_pin)
  • pinReadFast(_pin)

One the other hand it might even be better to remove the "private" implementatino of OneWire and just add a note to import that dependency (this will make getting this lib ready for Libraries 2.0 easier too).

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.