mirror of
https://github.com/KevinMidboe/python-gpiozero.git
synced 2025-10-29 09:40:36 +00:00
Remove incomplete TemperatureSensor for 1.0 release, close #93
This commit is contained in:
@@ -35,7 +35,7 @@ Install
|
||||
|
||||
First, install the dependencies::
|
||||
|
||||
sudo apt-get install python-pip python3-pip python-w1thermsensor python3-w1thermsensor python-spidev python3-spidev
|
||||
sudo apt-get install python-pip python3-pip python-spidev python3-spidev
|
||||
|
||||
Install with pip::
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ colour LEDs, robotics kits and more.
|
||||
First, install the dependencies:
|
||||
|
||||
```python
|
||||
sudo apt-get install python-pip python3-pip python-w1thermsensor python3-w1thermsensor python-spidev python3-spidev
|
||||
sudo apt-get install python-pip python3-pip python-spidev python3-spidev
|
||||
```
|
||||
|
||||
Install with pip:
|
||||
|
||||
@@ -175,42 +175,6 @@ LightSensor(pin=None, queue_len=5, charge_time_limit=10,
|
||||
| `when_light` | A reference to the function to be called when light is detected. | `None` or Function |
|
||||
| `when_dark` | A reference to the function to be called when darkness is detected. | `None` or Function |
|
||||
|
||||
## Temperature Sensor
|
||||
|
||||
One-wire Digital Temperature Sensor.
|
||||
|
||||
### Wiring
|
||||
|
||||
...
|
||||
|
||||
### Code
|
||||
|
||||
Ensure the `TemperatureSensor` class is imported at the top of the file:
|
||||
|
||||
```python
|
||||
from gpiozero import TemperatureSensor
|
||||
```
|
||||
|
||||
Create a `TemperatureSensor` object:
|
||||
|
||||
```python
|
||||
temp = TemperatureSensor()
|
||||
```
|
||||
|
||||
#### Initialisation options
|
||||
|
||||
...
|
||||
|
||||
#### Methods
|
||||
|
||||
...
|
||||
|
||||
#### Properties
|
||||
|
||||
| Property | Description | Type |
|
||||
| -------- | ----------- | ---- |
|
||||
| `value` | The current temperature reading in degrees Celsius. | Float |
|
||||
|
||||
## MCP3008 Analogue-to-Digital Converter
|
||||
|
||||
MCP3008 ADC (Analogue-to-Digital converter).
|
||||
|
||||
@@ -165,19 +165,20 @@ attached to:
|
||||
my_button = Button(2)
|
||||
```
|
||||
|
||||
Some classes require no arguments due to the nature of the device:
|
||||
Some classes have multiple arguments, usually with some being optional. When
|
||||
arguments are optional, common default values are used. The following example:
|
||||
|
||||
```python
|
||||
temp = TemperatureSensor()
|
||||
my_button = Button(2)
|
||||
```
|
||||
|
||||
Others have multiple arguments, usually with some being optional:
|
||||
is equivalent to:
|
||||
|
||||
```python
|
||||
temp = TemperatureSensor()
|
||||
my_button = Button(2, True)
|
||||
```
|
||||
|
||||
When arguments are optional, common default values are used.
|
||||
because the second argument defaults to `True`.
|
||||
|
||||
Arguments can be given unnamed, as long as they are in order:
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import (
|
||||
print_function,
|
||||
absolute_import,
|
||||
division,
|
||||
)
|
||||
)
|
||||
|
||||
from .devices import (
|
||||
GPIODeviceClosed,
|
||||
@@ -16,7 +16,6 @@ from .input_devices import (
|
||||
Button,
|
||||
MotionSensor,
|
||||
LightSensor,
|
||||
TemperatureSensor,
|
||||
AnalogInputDevice,
|
||||
MCP3008,
|
||||
MCP3004,
|
||||
|
||||
@@ -12,7 +12,6 @@ from time import sleep, time
|
||||
from threading import Event
|
||||
|
||||
from RPi import GPIO
|
||||
from w1thermsensor import W1ThermSensor
|
||||
from spidev import SpiDev
|
||||
|
||||
from .devices import (
|
||||
@@ -499,15 +498,6 @@ LightSensor.wait_for_light = LightSensor.wait_for_active
|
||||
LightSensor.wait_for_dark = LightSensor.wait_for_inactive
|
||||
|
||||
|
||||
class TemperatureSensor(W1ThermSensor):
|
||||
"""
|
||||
A Digital Temperature Sensor.
|
||||
"""
|
||||
@property
|
||||
def value(self):
|
||||
return self.get_temperature()
|
||||
|
||||
|
||||
class AnalogInputDevice(CompositeDevice):
|
||||
"""
|
||||
Represents an analog input device connected to SPI (serial interface).
|
||||
@@ -606,4 +596,3 @@ class MCP3004(MCP3008):
|
||||
if not 0 <= channel < 4:
|
||||
raise InputDeviceError('channel must be between 0 and 3')
|
||||
super(MCP3004, self).__init__(device, channel)
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import (
|
||||
print_function,
|
||||
absolute_import,
|
||||
division,
|
||||
)
|
||||
)
|
||||
|
||||
import warnings
|
||||
from time import sleep
|
||||
@@ -19,7 +19,7 @@ from .devices import (
|
||||
GPIOThread,
|
||||
CompositeDevice,
|
||||
SourceMixin,
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
class OutputDeviceError(GPIODeviceError):
|
||||
@@ -439,4 +439,3 @@ class Motor(SourceMixin, CompositeDevice):
|
||||
"""
|
||||
self._forward.off()
|
||||
self._backward.off()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user