Exemple #1
0
"""
 GridEYE_test.py 
 Alexander Hiam <*****@*****.**>
  
 Example program for PyBBIO's GridEYE library. 

 This example program is in the public domain.
"""

from bbio import *
from bbio.libraries.GridEYE import GridEYE

# Initialize the I2C bus:
I2C1.open()
# Create a GridEYE object:
grideye = GridEYE(I2C1)

ambient = grideye.getAmbientTemp()
frame = grideye.getFrame()

print "ambient temp: {:0.1f}C".format(ambient)
print "sensor temp:"
for y in range(8):
  string = ""
  for x in range(8):
     string += "  {:5.1f}".format(frame[y*8+x])
  print string
Exemple #2
0
"""
 GridEYE_test.py 
 Alexander Hiam <*****@*****.**>
  
 Example program for PyBBIO's GridEYE library. 

 This example program is in the public domain.
"""

from bbio import *
from bbio.libraries.GridEYE import GridEYE

# Initialize the I2C bus:
I2C1.open()
# Create a GridEYE object:
grideye = GridEYE(I2C1)

ambient = grideye.getAmbientTemp()
frame = grideye.getFrame()

print "ambient temp: {:0.1f}C".format(ambient)
print "sensor temp:"
for y in range(8):
    string = ""
    for x in range(8):
        string += "  {:5.1f}".format(frame[y * 8 + x])
    print string
Exemple #3
0
  # pip install PIL

 This example program is in the public domain.
"""

from bbio import *
from bbio.libraries.GridEYE import GridEYE
from PIL import Image
import colorsys

# Width and height of final image, 8x8 thermal image scaled to this size:
WIDTH = 600
HEIGHT = 600

I2C1.open()
grideye = GridEYE(I2C1)
# Enable the GridEYE's built-in moving average:
grideye.enableAveraging()


def generateImage(frame):
  min_temp = min(frame)
  max_temp = max(frame)
  
  for i in range(64):
    # Map temperature value to ratio of min and max temp:
    frame[i] -= min_temp
    frame[i] /= (max_temp - min_temp)

    # Convert ratio to (R, G, B):
    frame[i] = colorsys.hsv_to_rgb(1-frame[i], 1, 1)
  # pip install PIL

 This example program is in the public domain.
"""

from bbio import *
from bbio.libraries.GridEYE import GridEYE
from PIL import Image
import colorsys

# Width and height of final image, 8x8 thermal image scaled to this size:
WIDTH = 600
HEIGHT = 600

I2C1.open()
grideye = GridEYE(I2C1)
# Enable the GridEYE's built-in moving average:
grideye.enableAveraging()


def generateImage(frame):
    min_temp = min(frame)
    max_temp = max(frame)

    for i in range(64):
        # Map temperature value to ratio of min and max temp:
        frame[i] -= min_temp
        frame[i] /= (max_temp - min_temp)

        # Convert ratio to (R, G, B):
        frame[i] = colorsys.hsv_to_rgb(1 - frame[i], 1, 1)