Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions examples/tmp36-lm35.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
"""
tmp36-lm35.py
Alaa Agwa - 3/2014

Example program for PyBBIO's TMP36LM35 library.
Reads the temerature from the TMP36 or LM35 sensors from analog pin.

This example program is in the public domain.
"""
from bbio import *
from TMP36LM35 import *

data_pin = GPIO1_15 # P8.15

sensor = TMP36LM35(data_pin)

def setup():
pass

def loop():
temp = sensor.readTempC()
if (not temp):
# The sensor reported an error.
print "Error reading the sensor value"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent lines 23+24 by one more level

else:
print "Temp: %0.2f C" % temp
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

indent this line by one more level


delay(1000)

run(setup,loop)
16 changes: 16 additions & 0 deletions libraries/TMP36-LM35/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Servo - v0.1

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Servo" ?

Copyright 2014 Alaa Agwa
agwatic@gmail.com

Library for controlling servo motors with the BeagleBone's PWM pins.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Description needs to be corrected


As well as the included example programs:
PyBBIO/examples/tmp36-lm35.py



Servo is released as part of PyBBIO under its Apache 2.0 license.
See PyBBIO/LICENSE.txt

25 changes: 25 additions & 0 deletions libraries/TMP36-LM35/TMP36LM35.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
"""
Servo - v0.1
Copyright 2012 Alexander Hiam

Library for reading the values of TMP36/LM35 temperature sensors.
"""

from bbio import *

class TMP36LM35(object):
def __init__(self, data_pin=None):

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

empty line not needed

self.data_pin = data_pin

def readTempC(self):
""" Gets the sensor data in Celsius """
return ((analogRead(self.data_pin)*3.3)/1024) # 3.3 for the gpio pin it's max volt are 3.3 V


def readTempF(self):
""" Return the sensor data in Fahrenheit """
tempC = ((analogRead(self.data_pin)*3.3)/1024) # 3.3 for the gpio pin it's max volt are 3.3 V
return ((tempC * 9.0/5.0) + 32)


Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

strange EOF characters

3 changes: 3 additions & 0 deletions libraries/TMP36-LM35/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# __init__.py for TMP36LM35

from TMP36LM35 import *