mirror of
				https://github.com/KevinMidboe/python-gpiozero.git
				synced 2025-10-29 17:50:37 +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:: | 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:: | Install with pip:: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -34,7 +34,7 @@ colour LEDs, robotics kits and more. | |||||||
| First, install the dependencies: | First, install the dependencies: | ||||||
|  |  | ||||||
| ```python | ```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: | 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_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 | | | `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 Analogue-to-Digital Converter | ||||||
|  |  | ||||||
| MCP3008 ADC (Analogue-to-Digital converter). | MCP3008 ADC (Analogue-to-Digital converter). | ||||||
|   | |||||||
| @@ -165,19 +165,20 @@ attached to: | |||||||
| my_button = Button(2) | 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 | ```python | ||||||
| temp = TemperatureSensor() | my_button = Button(2) | ||||||
| ``` | ``` | ||||||
|  |  | ||||||
| Others have multiple arguments, usually with some being optional: | is equivalent to: | ||||||
|  |  | ||||||
| ```python | ```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: | Arguments can be given unnamed, as long as they are in order: | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ from __future__ import ( | |||||||
|     print_function, |     print_function, | ||||||
|     absolute_import, |     absolute_import, | ||||||
|     division, |     division, | ||||||
|     ) | ) | ||||||
|  |  | ||||||
| from .devices import ( | from .devices import ( | ||||||
|     GPIODeviceClosed, |     GPIODeviceClosed, | ||||||
| @@ -16,7 +16,6 @@ from .input_devices import ( | |||||||
|     Button, |     Button, | ||||||
|     MotionSensor, |     MotionSensor, | ||||||
|     LightSensor, |     LightSensor, | ||||||
|     TemperatureSensor, |  | ||||||
|     AnalogInputDevice, |     AnalogInputDevice, | ||||||
|     MCP3008, |     MCP3008, | ||||||
|     MCP3004, |     MCP3004, | ||||||
|   | |||||||
| @@ -12,7 +12,6 @@ from time import sleep, time | |||||||
| from threading import Event | from threading import Event | ||||||
|  |  | ||||||
| from RPi import GPIO | from RPi import GPIO | ||||||
| from w1thermsensor import W1ThermSensor |  | ||||||
| from spidev import SpiDev | from spidev import SpiDev | ||||||
|  |  | ||||||
| from .devices import ( | from .devices import ( | ||||||
| @@ -499,15 +498,6 @@ LightSensor.wait_for_light = LightSensor.wait_for_active | |||||||
| LightSensor.wait_for_dark = LightSensor.wait_for_inactive | 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): | class AnalogInputDevice(CompositeDevice): | ||||||
|     """ |     """ | ||||||
|     Represents an analog input device connected to SPI (serial interface). |     Represents an analog input device connected to SPI (serial interface). | ||||||
| @@ -606,4 +596,3 @@ class MCP3004(MCP3008): | |||||||
|         if not 0 <= channel < 4: |         if not 0 <= channel < 4: | ||||||
|             raise InputDeviceError('channel must be between 0 and 3') |             raise InputDeviceError('channel must be between 0 and 3') | ||||||
|         super(MCP3004, self).__init__(device, channel) |         super(MCP3004, self).__init__(device, channel) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,7 @@ from __future__ import ( | |||||||
|     print_function, |     print_function, | ||||||
|     absolute_import, |     absolute_import, | ||||||
|     division, |     division, | ||||||
|     ) | ) | ||||||
|  |  | ||||||
| import warnings | import warnings | ||||||
| from time import sleep | from time import sleep | ||||||
| @@ -19,7 +19,7 @@ from .devices import ( | |||||||
|     GPIOThread, |     GPIOThread, | ||||||
|     CompositeDevice, |     CompositeDevice, | ||||||
|     SourceMixin, |     SourceMixin, | ||||||
|     ) | ) | ||||||
|  |  | ||||||
|  |  | ||||||
| class OutputDeviceError(GPIODeviceError): | class OutputDeviceError(GPIODeviceError): | ||||||
| @@ -439,4 +439,3 @@ class Motor(SourceMixin, CompositeDevice): | |||||||
|         """ |         """ | ||||||
|         self._forward.off() |         self._forward.off() | ||||||
|         self._backward.off() |         self._backward.off() | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user