def get_temp_ncontact():
    # Define a function to convert celsius to fahrenheit.
    def c_to_f(c):
        return c * 9.0 / 5.0 + 32.0

    # Create library object using Bus I2C port
    i2c = busio.I2C(board.SCL, board.SDA)
    sensor = adafruit_tmp006.TMP006(i2c)

    # Initialize communication with the sensor, using the defaul16 samples
    # This is the best accuracy but a little slower at reacting to changes.
    # The first sample will be meaningless
    while True:
        obj_temp = sensor.temperature
        print('Object temperature: {0:0.3F}*C / {1:0.3F}*F'.format(obj_temp, c_to_f(obj_temp)))
        time.sleep(5.0)
示例#2
0
import time
import board
import busio
import adafruit_tmp006


# Define a function to convert celsius to fahrenheit.
def c_to_f(c):
    return c * 9.0 / 5.0 + 32.0


# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_tmp006.TMP006(i2c)

# Initialize communication with the sensor, using the default 16 samples per conversion.
# This is the best accuracy but a little slower at reacting to changes.
# The first sample will be meaningless
while True:
    obj_temp = sensor.temperature
    print('Object temperature: {0:0.3F}*C / {1:0.3F}*F'.format(
        obj_temp, c_to_f(obj_temp)))
    time.sleep(5.0)
示例#3
0
def create_TMP006():
    i2c = busio.I2C(board.SCL, board.SDA)
    sensor = adafruit_tmp006.TMP006(i2c)
    return sensor
示例#4
0
import adafruit_adxl34x
import adafruit_tmp006
import adafruit_ads1x15.ads1015

#i2c initialization
i2c = busio.I2C(board.SCL, board.SDA)

#accelerometer initialization
accel = adafruit_adxl34x.ADXL345(i2c)

#adc initialization
from adafruit_ads1x15.analog_in import AnalogIn
adc = adafruit_ads1x15.ADS1015(i2c)

#temp initialization
temp = adafruit_tmp006.TMP006(i2c)

while True:
    #print acceleration data
    print("Acceleration - X: %f Y: %f Z: %f" % accel.acceleration)
    if bool(accel.events["freefall"]): print("Sensor dropped!")
    if bool(accel.events["tap"]): print("Sensor tapped!")
    if bool(accel.events["motion"]): print("Sensor moved!")

    #print pulse
    Signal = adc.read_adc(0, gain=GAIN)  #ADC channel 0
    curTime = int(time.time() * 1000)

    sampleCounter += curTime - lastTime
    #                   # keep track of the time in mS with this variable
    lastTime = curTime
import time
import board
import busio
import adafruit_tmp006
import adafruit_tcs34725
from Adafruit_BNO055 import BNO055

t = 0
# Create library object using our Bus I2C port
i2c = busio.I2C(board.SCL, board.SDA)
tmp1 = adafruit_tmp006.TMP006(i2c, 0x40)
tcs = adafruit_tcs34725.TCS34725(i2c, 0x29)
bno = BNO055.BNO055()
# Initialize communication with the sensor, using the default 16 samples per conversion.
# This is the best accuracy but a little slower at reacting to changes.
# The first sample will be meaningless
while t < 10:
    obj_temp = tmp1.temperature
    #print(obj_temp)
    r, g, b = tcs.color_rgb_bytes
    print(tmp1._read_die_temperature)
    print('Object temperature: {0:8.2f}'.format(tmp1.temperature))
    print('RED:{0:3d} GREEN:{1:3d} BLUE:{2:3d}'.format(r, g, b))
    time.sleep(5)
    t = +1