Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ronanguilloux committed Nov 23, 2012
0 parents commit 23bfa60
Show file tree
Hide file tree
Showing 5 changed files with 135 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .gitignore
@@ -0,0 +1,6 @@
vendor/
composer.lock
composer.phar
phpunit.phar
phpunit.xml
php-cs-fixer.phar
19 changes: 19 additions & 0 deletions LICENSE
@@ -0,0 +1,19 @@
Copyright (C) 2012 Ronan Guilloux

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
72 changes: 72 additions & 0 deletions README.md
@@ -0,0 +1,72 @@
temperature-pi
==============

**temperature-pi** is a simple Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor, & a local sqlite database.
It's based on the [php-gpio](https://github.com/ronanguilloux/php-gpio) PHP library

[![Build Status](https://secure.travis-ci.org/ronanguilloux/temperature-pi.png?branch=master)](http://travis-ci.org/ronanguilloux/temperature-pi)


Installation
------------

The recommended way to install temperature-pi is through [composer](http://getcomposer.org).

Just create a `composer.json` file for your project:

``` json
{
"require": {
"php": ">=5.3.0",
"ronanguilloux/temperature-pi": "master-dev"
}
}
```

And run these two commands to install it:

``` bash
$ wget http://getcomposer.org/composer.phar
$ php composer.phar install
```

Now you can add the autoloader, and you will have access to the library:

``` php
<?php

require 'vendor/autoload.php';
```

If you don't use neither **Composer** nor a _ClassLoader_ in your application, just require the provided autoloader:

``` php
<?php

require_once 'src/autoload.php';
```


Usage
-----

``` php
<?php
require 'vendor/autoload.php';
$sensor = new PhpGpio\Sensors\DS18B20();
$currentTemperature = sensor->read();
```


Credits
-------

* Ronan Guilloux <ronan.guilloux@gmail.com>
* [All contributors](https://github.com/ronanguilloux/temperature-pi/contributors)


License
-------

**temperature-pi** is released under the MIT License. See the bundled LICENSE file for details.
You can find a copy of this software here: https://github.com/ronanguilloux/temperature-pi
21 changes: 21 additions & 0 deletions composer.json
@@ -0,0 +1,21 @@
{
"name": "ronanguilloux/temperature-pi",
"type": "application to be run as a daemon",
"description": "Raspberry Pi based temperature logger using a DS18B20 1-Wire digital temperature sensor",
"keywords": ["temperature", "logger", "DS18B20", "sensors", "raspberry", "raspberry pi"],
"homepage": "https://github.com/ronanguilloux/temperature-pi",
"license": "MIT",
"authors": [
{
"name": "Ronan Guilloux",
"email": "ronan.guilloux@gmail.com"
}
],
"require": {
"php": ">=5.3.0",
"ronanguilloux/php-gpio": "master-dev"
},
"autoload": {
"psr-0": { "TemperaturePi": "src/" }
}
}
17 changes: 17 additions & 0 deletions src/TemperaturePi/Logger.php
@@ -0,0 +1,17 @@
<?php

namespace TemperaturePi;

use PhpGpio\Sensors\DS18B20();

class Logger
{
private $sensor;
private $currentTemperature;

public function __construct()
{
$this->sensor = new DS18B20();
$this->currentTemperature = sensor->read();
}
}

0 comments on commit 23bfa60

Please sign in to comment.