5
5
from __future__ import division
6
6
import copy
7
7
import math
8
- import sys
9
- import os
10
- import psutil
11
- import time
8
+ import sys , os , time
9
+ #import psutil
10
+
12
11
13
12
class led_display (object ):
14
13
def __init__ (self ):
@@ -17,7 +16,6 @@ def __init__(self):
17
16
def toggle (self ):
18
17
pass
19
18
20
-
21
19
# Function to draw a pretty pattern to the display.
22
20
def animate (self ):
23
21
pass
@@ -33,19 +31,35 @@ def translate(value, leftMin, leftMax, rightMin, rightMax):
33
31
# Convert the 0-1 range into a value in the right range.
34
32
return rightMin + (valueScaled * rightSpan )
35
33
36
-
37
34
def sensorget ():
38
- statusram = psutil .virtual_memory ()
35
+ # statusram = psutil.virtual_memory()
39
36
40
- sensordict = {'humidity' : 0 , 'temp' :0 , 'humidtemp' :0 , 'pressuretemp' :0 ,'pressure' :0 ,'compass' :0 }
41
- sensordict ['humidity' ] = psutil .cpu_percent ()
42
- sensordict ['temp' ] = psutil .sensors_temperatures ()['acpitz' ][0 ].current
43
- sensordict ['humidtemp' ] = psutil .cpu_percent ()
44
- sensordict ['pressuretemp' ] = psutil .cpu_percent ()
45
- sensordict ['pressure' ] = translate (statusram .percent , 0 , 100 , 260 , 1260 )
46
- #psutil.disk_usage('/').percent + 260
47
- sensordict ['compass' ] = {"x" : 2 , "y" : 2 , "z" : 3 }
48
- return sensordict
37
+ # sensordict = {'humidity': 0, 'temp':0, 'humidtemp':0, 'pressuretemp':0,'pressure':0,'compass':0}
38
+ # sensordict['humidity'] = psutil.cpu_percent()
39
+ # sensordict['temp'] = psutil.sensors_temperatures()['acpitz'][0].current
40
+ # sensordict['humidtemp'] = psutil.cpu_percent()
41
+ # sensordict['pressuretemp'] = psutil.cpu_percent()
42
+ # sensordict['pressure'] = translate(statusram.percent, 0, 100, 260, 1260)
43
+ # #psutil.disk_usage('/').percent + 260
44
+ # sensordict['compass'] = {"x" : 2, "y" : 2, "z" : 3}
45
+ # return sensordict
46
+
47
+ # also commented import psutil in favor of vanilla/built-in option os, sys, and or subsystem
48
+ # place holder to read and pass data
49
+ # error handeling and data compatiblity
50
+
51
+ sensordict = {'humidity' : 0 , 'temp' :0 , 'humidtemp' :0 , 'pressuretemp' :0 ,'pressure' :0 ,'compass' :0 }
52
+ # BPE680 Temprature in c
53
+ sensordict ['temp' ] = float (os .popen ("python3 /home/beta/bme680-python/examples/its_bme680PHT.py -c" ).read ())
54
+ # BMP Pressure in hPa
55
+ sensordict ['pressure' ] = float (os .popen ("python3 /home/beta/its_bmp280/its_bmp280.py -p" ).read ())
56
+ # BME humidity in rh%
57
+ sensordict ['humidity' ] = float (os .popen ("python3 /home/beta/bme680-python/examples/its_bme680PHT.py -h" ).read ())
58
+ # mpu60xx motion/magnet in x, y, z
59
+ sensordict ['compass' ] = {os .popen ("python3 /home/beta/its-i2cpnpWebApp/its_mpu60xx.py" ).read ()}
60
+
61
+ print (sensordict )
62
+ return sensordict
49
63
50
64
def printscreen (sensordict ):
51
65
print ("Temperature: %s C" % sensordict ['temp' ])
@@ -54,4 +68,3 @@ def printscreen(sensordict):
54
68
print ("Pressure: %s Millibars" % sensordict ['pressure' ])
55
69
print ("Humidity: %s %%rH" % sensordict ['humidity' ])
56
70
print ("North: %s" % sensordict ['compass' ])
57
-
0 commit comments