Esempio n. 1
0
os.system("sudo modprobe w1-gpio && sudo modprobe w1-therm && cd /sys/bus/w1/devices/ && ls && cd 28-000003e48b1e && cat w1_slave")
bmp = BMP085(0x77)
temp = bmp.readTemperature()
pressure = bmp.readPressure()
altitude = bmp.readAltitude()

while True:
	tfile = open("/sys/bus/w1/devices/28-000003e48b1e/w1_slave")
	text = tfile.read()
	tfile.close()
	secondline = text.split("\n")[1]
	temperaturedata = secondline.split(" ")[9]
	temperature = float(temperaturedata[2:])
	temperature = temperature/1000
	print (temperature)
	print "Temperature: %.2f C" % temp
        print "Pressure:    %.2f hPa" % (pressure / 100.0)
        print "Altitude:    %.2f" % altitude
	
        urbandata.send( 14.123, -90.1234, {
        'temperature': temperature,
        'barometer_BMP085_temperature1': temp,
        'pressure': (pressure / 100.0),
        'altitude': altitude,
        #'humidity': 123.4567
        }) 




Esempio n. 2
0
import urbandata
import random

for i in range(1,100):
  urbandata.send(random.uniform(14.5, 14.7), random.uniform(-90.50, -90.60), {
      'temperature': random.uniform(24.5, 27.7),
      'humidity': random.uniform(1, 10),
      'uvlight': random.uniform(1, 10),
      'sunlight': random.uniform(1, 10),
      'noise': random.uniform(1, 10),
      'co2': random.uniform(1,10)
    })