Giter Site home page Giter Site logo

onewire_therm's Introduction

On your Raspberry-PI with Raspian Wheezy OS, if you've wired up your OneWire thermistors correctly via pin 4 they will show up in your devices list.

ls -lrt /sys/bus/w1/devices
total 0
lrwxrwxrwx 1 root root 0 Apr  9 11:22 w1_bus_master1 -> ../../../devices/w1_bus_master1
lrwxrwxrwx 1 root root 0 Apr  9 11:22 28-000004753e42 -> ../../../devices/w1_bus_master1/28-000004753e42
lrwxrwxrwx 1 root root 0 Apr  9 11:22 28-000004752948 -> ../../../devices/w1_bus_master1/28-000004752948
lrwxrwxrwx 1 root root 0 Apr  9 11:22 28-000004749085 -> ../../../devices/w1_bus_master1/28-000004749085
lrwxrwxrwx 1 root root 0 Apr  9 11:33 28-0000043792e5 -> ../../../devices/w1_bus_master1/28-0000043792e5

And in Erlang

1> onewire_therm_manager:subscribe("w1", "28-0000043792e5").
{ok,undefined,undefined} % undefined temperature and timestamp after
                         % initial start

2> flush().
Shell got {therm,{"w1","28-0000043792e5"},15.437,{1365,511902,564105}}
ok
3> flush().
Shell got {therm,{"w1","28-0000043792e5"},15.375,{1365,511914,599490}}
Shell got {therm,{"w1","28-0000043792e5"},15.437,{1365,511917,439586}}
ok
4> onewire_therm_manager:unsubscribe("w1", "28-0000043792e5").
ok % from specific device
5> onewire_therm_manager:subscribe("w1", "28-0000043792e5").
{ok,15.312,{1365,515681,309393}} % was already running so gave a value 
                                 % straight away
6> onewire_therm_manager:subscribe("w1", "28-000004753e42").
{ok,undefined,undefined} % undefined temperature and timestamp after
                         % intiial start for this sensor
7> flush().
Shell got {therm,{"w1","28-000004753e42"},15.375,{1365,517785,992688}}
Shell got {therm,{"w1","28-0000043792e5"},15.687,{1365,517792,786987}}
ok
8> onewire_therm_manager:unsubscribe().
ok % from all

You do not need to monitor or link to any processes in onewire_therm, even if they crash during normal operation they will not affect your subscription, meaning you will eventually receive more messages once the relevant crashed processes come back up.

onewire_therm's People

Contributors

mokele avatar tverlaan avatar

Watchers

Zhonghai Zuo avatar James Cloos avatar

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.