From 319169e9da5839e8468d7fc21a4e7d25045e773c Mon Sep 17 00:00:00 2001 From: Ben Nuttall Date: Sun, 16 Jul 2017 12:21:09 +0100 Subject: [PATCH] Add print temperature to CPUTemperature example and add temperature property to docs --- docs/api_other.rst | 2 +- gpiozero/other_devices.py | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/docs/api_other.rst b/docs/api_other.rst index ea78c07..7193b7e 100644 --- a/docs/api_other.rst +++ b/docs/api_other.rst @@ -31,6 +31,7 @@ CPUTemperature ============== .. autoclass:: CPUTemperature + :members: temperature, is_active Base Classes ============ @@ -50,4 +51,3 @@ InternalDevice .. autoclass:: InternalDevice() :members: - diff --git a/gpiozero/other_devices.py b/gpiozero/other_devices.py index 1f51f7e..ea31802 100644 --- a/gpiozero/other_devices.py +++ b/gpiozero/other_devices.py @@ -87,10 +87,12 @@ class CPUTemperature(InternalDevice): # Use minimums and maximums that are closer to "normal" usage so the # bar graph is a bit more "lively" - temp = CPUTemperature(min_temp=50, max_temp=90) + cpu = CPUTemperature(min_temp=50, max_temp=90) + + print('Initial temperature: {}C'.format(cpu.temperature)) graph = LEDBarGraph(5, 6, 13, 19, 25, pwm=True) - graph.source = temp.values + graph.source = cpu.values pause()