myweather/weather.py
unixweb 30d55ba1b5 Update new Version
New createTable.sql with new rows for more sensors.
New scheduler.py put more sensor data into the new database design.
Update weather.py for import data into scheduler.py
2015-05-21 19:14:11 +02:00

36 lines
1.3 KiB
Python
Executable File

#!/usr/bin/python
# Can enable debug output by uncommenting:
#import logging
#logging.basicConfig(level=logging.DEBUG)
import Adafruit_BMP.BMP085 as BMP085
# Default constructor will pick a default I2C bus.
#
# For the Raspberry Pi this means you should hook up to the only exposed I2C bus
# from the main GPIO header and the library will figure out the bus number based
# on the Pi's revision.
#
# For the Beaglebone Black the library will assume bus 1 by default, which is
# exposed with SCL = P9_19 and SDA = P9_20.
sensor = BMP085.BMP085()
# Optionally you can override the bus number:
#sensor = BMP085.BMP085(busnum=2)
# You can also optionally change the BMP085 mode to one of BMP085_ULTRALOWPOWER,
# BMP085_STANDARD, BMP085_HIGHRES, or BMP085_ULTRAHIGHRES. See the BMP085
# datasheet for more details on the meanings of each mode (accuracy and power
# consumption are primarily the differences). The default mode is STANDARD.
#sensor = BMP085.BMP085(mode=BMP085.BMP085_ULTRAHIGHRES)
Temp1 = format(sensor.read_temperature())
Temp2 = format(sensor.read_temperature())
Temp3 = format(sensor.read_temperature())
Temp4 = format(sensor.read_temperature())
Pressure = format(sensor.read_pressure()/100)
Sea_pressure = format(sensor.read_sealevel_pressure()/100)
Altitude = format(sensor.read_altitude())
Humidity= 57