Before writing a Python program to measure and report the temperature, we can try some experiments in the Python Console.

To launch the Python Console type:
# python
Python 2.7.3 (default, Apr  3 2013, 21:37:23) 
[GCC 4.7.3 20130205 (prerelease)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
First, we need to import the library, so enter the command:
>>> import Adafruit_BBIO.ADC as ADC
Now enter the command below into the Python Console to setup the ADC (Analog to Digital Convertor).
>>> ADC.setup()
You can now read the value at the analog input (between 0 and 1) using the command below. Try it a few times while putting your finger on the TMP36 to warm it up. The readings should gradually increase.
Note: Using the up arrow will repeat the last line that you entered in the Python Console.
These readings are not yet an actual temperature, so in the next section we will write a short Python program to display the temperature in both degrees C and F.

This guide was first published on Jun 27, 2013. It was last updated on Jun 27, 2013.

This page (The Python Console) was last updated on Jun 27, 2013.

Text editor powered by tinymce.