Beispiel #1
0
def main():
    liste = [4]
    # création instance
    filin = open("fichierCouleurs.txt", "w")

    i2c = busio.I2C(board.SCL, board.SDA)
    tca = adafruit_tca9548a.TCA9548A(i2c)

    sensor0 = adafruit_tcs34725.TCS34725(tca[0])
    data0 = sensor0.color_raw
    print(data0)
    # with open("fichierCouleurs.txt", "w") as filout:
    # filout.write(data0)

    sensor1 = adafruit_tcs34725.TCS34725(tca[1])
    data1 = sensor1.color_raw
    print(data1)
    # with open("fichierCouleurs.txt", "w") as filout:
    # filout.write(data1)

    sensor2 = adafruit_tcs34725.TCS34725(tca[2])
    data2 = sensor2.color_raw
    print(data2)
    # with open("fichierCouleurs.txt", "w") as filout:
    # filout.write(data2)

    sensor3 = adafruit_tcs34725.TCS34725(tca[3])
    data3 = sensor3.color_raw
    print(data3)
Beispiel #2
0
def main():
    a = 0
    matriceCouleurs = [[]]
    tabCouleurs = []
    liste = []
    liste2 = []
    # création instance
    filin = open("fichierCouleurs.txt", "a")

    i2c = busio.I2C(board.SCL, board.SDA)
    tca = adafruit_tca9548a.TCA9548A(i2c, 0x70)
    # erreur viens de l'adresse donner en parametres
    #tca2 = adafruit_tca9548a.TCA9548A(i2c, 0x71)

    #création des capteurs en tableau avec affectation valeurs utilisable
    for x in range(0, 4):
        liste.append(adafruit_tcs34725.TCS34725(tca[x]))
        liste[x].gain = 16
        liste[x].integration_time = 200

    print(
        "Chaque capteur possède un gain = 16 et un temps d'intégration = 200ms"
    )
    # récupération data et test de la couleurs qui lui est lié
    for x in range(0, 4):
        data = liste[x].color_raw
        dataLux = liste[x].lux
        with open("fichierCouleurs.txt", "a") as filout:
            filout.write("\n" + str(data))
        print("data0 = ", data)
        print("Luminosité0 = ", dataLux)
        tabCouleurs.append(testCouleurs(data))

# changement multiplexeur
    tca = adafruit_tca9548a.TCA9548A(i2c, 0x71)

    for x in range(0, 4):
        liste2.append(adafruit_tcs34725.TCS34725(tca[x]))
        liste2[x].gain = 16
        liste2[x].integration_time = 200

    for x in range(0, 4):
        data2 = liste2[x].color_raw
        dataLux2 = liste2[x].lux
        with open("fichierCouleurs.txt", "a") as filout:
            filout.write("\n" + str(data2))
        print("data1 = ", data2)
        print("Luminosité1 = ", dataLux2)
        tabCouleurs.append(testCouleurs(data2))

    print(tabCouleurs)

    for x in range(4):
        for i in range(2):
            matriceCouleurs[x].append(tabCouleurs[i])
def definition_capteurs(i2c, listeCapteurs):
    # premiere fournée de capteurs
    for x in range(0, 6):
        if (x < 2):  #0 et 1 affecter au tca 2
            tca = adafruit_tca9548a.TCA9548A(i2c, 0x70)
            listeCapteurs.append(adafruit_tcs34725.TCS34725(tca[x]))
            listeCapteurs[x].gain = 16
            listeCapteurs[x].integration_time = 200
        else:  # les autres sont affecter avec le deuxième multiplexeur
            tca = adafruit_tca9548a.TCA9548A(i2c, 0x71)
            listeCapteurs.append(adafruit_tcs34725.TCS34725(tca[x - 2]))
            listeCapteurs[x].gain = 16
            listeCapteurs[x].integration_time = 200

    return listeCapteurs
 def __init__(self, sensoraddress, idval, integration_time=200, gain=60):
     self.__rgb = None
     self.__temperature = None
     self.__lux = None
     self.__sensor = adafruit_tcs34725.TCS34725(I2C)
     self.integration_time = integration_time
     self.gain = gain
     super().__init__(sensoraddress, idval)
    def __init__(self, component_id):
        # self.color_sensor = I2C(0x29)

        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.sensor = adafruit_tcs34725.TCS34725(self.i2c)
        self.sensor.gain = 16

        self.component_id = component_id
Beispiel #6
0
 def __init__(self, datapin, pwr_pin = 17  ):
     """Instantiate Light Sensor object using keyword arguments."""
     self.datapin = datapin
     self.pwr_pin = pwr_pin
     GPIO.setmode(GPIO.BCM) # use broadcom pin numbering on Raspberry Pi
     GPIO.setup(self.pwr_pin, GPIO.OUT) # Allocate power pin, set pin to output mode
     self.powerUp(pwr_pin)
     i2cbus = busio.I2C(board.SCL, board.SDA) # Setup i2c bus
     self.sample_rate = 5
     self.light_sensor_config = adafruit_tcs34725.TCS34725(i2cbus)
Beispiel #7
0
    def read_Color_In(self):
        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.sensor = colorer.TCS34725(self.i2c)

        red, green, blue = self.sensor.color_rgb_bytes
        Colors = [red, green, blue]  #Vectorized to use in for loops

        PWM.set_duty_cycle(self.RED, 100 - Colors[0])  # Red
        PWM.set_duty_cycle(self.GREEN, 100 - Colors[1])  # Green
        PWM.set_duty_cycle(self.BLUE, 100 - Colors[2])  # Blue
        print("REd, GrEeN, BlUe")
Beispiel #8
0
    def __init__(self):
        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.station_id = "Amsterdam"

        self.cpu = CPUTemperature()
        self.sht = adafruit_shtc3.SHTC3(self.i2c)
        self.lps = adafruit_lps2x.LPS22(self.i2c, 0x5c)

        self.tcs = adafruit_tcs34725.TCS34725(self.i2c)
        self.tcs.integration_time = 200

        self.icm = adafruit_icm20x.ICM20948(self.i2c, 0x68)
        self.ads = ADS.ADS1015(self.i2c)
Beispiel #9
0
def colorSensorReader(RED, GREEN, BLUE):
    i2c = busio.I2C(board.SCL, board.SDA)
    sensor = colorer.TCS34725(i2c)

    dog = sensor.color_rgb_bytes  #dog is a tuple, so the information has to be unpacked
    red, green, blue = dog
    Colors = [red, green, blue]  #Vectorized to use in for loops

    PWM.set_duty_cycle(
        RED, 100 - Colors[0]
    )  # Red      Important to make these opposite, as the light emits what the sensor does not pick up
    PWM.set_duty_cycle(GREEN, 100 - Colors[1])  # Green
    PWM.set_duty_cycle(BLUE, 100 - Colors[2])  # Blue
    def read_Color_In(self):
        self.i2c = busio.I2C(board.SCL, board.SDA)
        self.sensor = colorer.TCS34725(self.i2c)

        red, green, blue = self.sensor.color_rgb_bytes
        Colors = [red, green, blue]  #Vectorized

        PWM.set_duty_cycle(
            self.redPin, 100 - Colors[0]
        )  # Red: Has to be this way because emitters do the opposite of what readers do
        PWM.set_duty_cycle(self.greenPin, 100 - Colors[1])  # Green
        PWM.set_duty_cycle(self.bluePin, 100 - Colors[2])  # Blue
        print("REd, GrEeN, BlUe")
def getColorRange(trys):
    currentTry = 0
    sensorArray = []
    reds = []
    greens = []
    blues = []
    for mpx_channel in mpx_channels:
        sensorArray.append(adafruit_tcs34725.TCS34725(mpx[mpx_channel]))
    while currentTry < trys:
        for sensor in sensorArray:
            reds.append(sensor.color_rgb_bytes[0])
            greens.append(sensor.color_rgb_bytes[1])
            blues.append(sensor.color_rgb_bytes[2])
        currentTry += 1
    print("COLOR\tMIN\tMAX")
    print("RED\t"+str(min(reds))+"\t"+str(max(reds)))
    print("GREEN\t"+str(min(greens))+"\t"+str(max(greens)))
    print("BLUE\t"+str(min(blues))+"\t"+str(max(blues)))
Beispiel #12
0
def read_sensor(location="", extra="", sensor_name="", *args):
    # Try importing the modules then give-up and report to user if it fails
    import datetime
    import time
    try:
        import board
        import busio
        import adafruit_tcs34725
    except:
        print(
            "adafruit_tcs34725 module not installed, install using the command;"
        )
        print("   sudo pip3 install adafruit-circuitpython-tcs34725   ")
        return None

    # set up and read the sensor
    read_attempt = 1
    i2c = busio.I2C(board.SCL, board.SDA)
    sensor = adafruit_tcs34725.TCS34725(i2c)
    gain = 1
    sensor.gain = gain  # 1, 4, 16, 60
    sensor.integration_time = 50  # The integration time of the sensor in milliseconds.  Must be a value between 2.4 and 614.4.
    while read_attempt < 5:
        try:
            color_temp = sensor.color_temperature
            lux = sensor.lux
            rgb = sensor.color_rgb_bytes
            #
            if lux == None:
                print("--problem reading tcs34725, try " + str(read_attempt))
                time.sleep(2)
                read_attempt = read_attempt + 1
            else:
                logtime = datetime.datetime.now()
                return [['time', logtime], ['lux', str(lux / gain)],
                        ['color_temp', color_temp], ['r', rgb[0]],
                        ['g', rgb[1]], ['b', rgb[2]]]
        except Exception as e:
            print("--exception while reading tcs34725, try " +
                  str(read_attempt))
            print(" -- " + str(e))
            time.sleep(2)
            read_attempt = read_attempt + 1
    return None
 def __init__(self, i2c):
     self.sensor = adafruit_tcs34725.TCS34725(i2c)
Beispiel #14
0
def main():
    #test bdd
    nom = "Pablo"
    prenom = "Emilio"
    calculDonne = "12/6"
    calculPosee = "12/6"

    resultat = ""
    resultatDonne = "2"
    resultatEnvoie = ""
    tour = 0
    juste = 0
    calculPose = ""
    tabCouleurs = []
    liste = []
    liste2 = []
    dataL = 0
    attente = 0
    # création instances
    pinBTN1 = 21  #recup data led
    pinBTN2 = 23  #demande exo
    pinBTN3 = 17  #oui (true)
    pinBTN4 = 27  #non (false)
    pinLED = 16  #manip led
    etat3 = 0
    etat4 = 0
    GPIO.setmode(GPIO.BCM)
    GPIO.setup(
        pinBTN1, GPIO.IN,
        pull_up_down=GPIO.PUD_UP)  #bouton poussoir 1 Capter + Envoie donnée
    GPIO.setup(pinBTN2, GPIO.IN,
               pull_up_down=GPIO.PUD_UP)  #bouton poussoir 2 Exo
    GPIO.setup(pinLED, GPIO.OUT)  #manip led
    GPIO.setup(pinBTN3, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #Bouton True
    GPIO.setup(pinBTN4, GPIO.IN, pull_up_down=GPIO.PUD_UP)  #bouton False

    while True:  #programme continue
        while True:  # attente
            GPIO.output(pinLED, False)  #led eteinte
            i2c = busio.I2C(board.SCL, board.SDA)
            tca = adafruit_tca9548a.TCA9548A(i2c)

            #création des capteurs en tableau avec affectation valeurs utilisable
            if (tour == 0):  #si c'est le premier tour on déclarre
                for x in range(0, 2):
                    liste.append(adafruit_tcs34725.TCS34725(tca[x]))
                    liste[x].gain = 16
                    liste[x].integration_time = 200
                tour += 1  # tour = nb capteurs penser à changer

            dataL = liste[0].lux
            if (dataL < 5):
                GPIO.output(pinLED, not GPIO.input(pinLED)
                            )  # changement d'état (allumer normalement)

            etat1 = GPIO.input(
                pinBTN1)  #récupération état du bouton envoie data
            etat2 = GPIO.input(pinBTN2)  #récupération état du bouton exo
            etat3 = GPIO.input(pinBTN3)
            etat4 = GPIO.input(pinBTN4)
            if (etat1 == 0 and etat2 == 1
                ):  #permet de ne pas activer les 2 boutons en même temps
                # fonctionnement du programme de récupération des couleurs (charactère)
                # récupération data et test de la couleurs qui lui est lié
                for x in range(0, 2):
                    time.sleep(
                        0.5)  #laisser le temps de se mettre à la lumière
                    data = liste[
                        x].color_raw  #récup valeurs capteur multiplexeur 1
                    print(data)
                    tabCouleurs.append(testCouleurs(data))

                # changement multiplexeur
                tca = adafruit_tca9548a.TCA9548A(i2c, 0x71)

                if (tour == 1
                    ):  #deuxième remplissage (tour = nb capteur avant !)
                    for x in range(0, 4):
                        liste2.append(adafruit_tcs34725.TCS34725(tca[x]))
                        liste2[x].gain = 16
                        liste2[x].integration_time = 200
                    tour += 1

                for x in range(0, 4):
                    data1 = liste2[
                        x].color_raw  #récup valeurs capteur multiplexeur 2
                    print("data1 = ", data1)
                    tabCouleurs.append(testCouleurs(data1))

                # remplissage matrice couleurs

                matriceCouleurs = [
                    tabCouleurs[i:i + 2] for i in range(0, 6, 2)
                ]
                # on fait la range avec le pas que l'on souhaite
                print(matriceCouleurs)
                calculPose += testCaractere(matriceCouleurs)
                #calcul
                print(tabCouleurs)
                resultat = eval(calculPose)

                if (resultat == eval(calculDonne) and juste == 0):
                    juste += 1  #si un calcul est juste on peut pas revenir ici
                    print("Pose le resultat maintenant !")
                    resultatEnvoie = verif(liste, liste2, pinBTN1, pinBTN2,
                                           pinLED)  #resultat pose par l'éléeve
                    if (resultatEnvoie == resultatDonne
                        ):  #resultat donne par l'eleve est juste
                        print("Bien jouer ! Tu as juste !")
                        print(eval(resultatEnvoie))
                        print(eval(calculPosee))
                        # envoie du calcul à la fin
                        insert(prenom, nom, calculDonne, calculPose,
                               resultatEnvoie)
                        break
                    else:
                        print("Faux, veux tu reposer le resultat ?")
                        insert(prenom, nom, calculDonne, calculPose,
                               resultatEnvoie)
                        print(resultatEnvoie)
                        print(calculPosee)
                        while (True):
                            etat3 = GPIO.input(pinBTN3)
                            etat4 = GPIO.input(pinBTN4)
                            if (etat3 == 0 or etat4 == 0):
                                break
                        if (etat3 == 0
                                and etat4 == 1):  # si appuyer sur btn3 = oui
                            print("Tu recommence")
                            print("retry")
                            break  # on remonte juste avec l'exercice en cours
                        if (etat4 == 0
                                and etat3 == 1):  # si appuyer sur BTN4 = non
                            print("Tu abandonnes")
                            print("echec !")
                            break  # fin exercice et en redemander un (peut etre demander avant de remonter)
                else:
                    print("calcul mal poser")
                    print(
                        "Veux tu recommencer l'exercice ?")  #bouton Oui et Non
                    etat3 = input(GPIO.input(pinBTN3))
                    etat4 = input(GPIO.input(pinBTN4))
                    if (etat3 == 0 and etat4 == 1):  #si appuyer sur btn3 = oui
                        print("retry")
                        break  #on remonte juste avec l'exercice en cours
                    if (etat4 == 0 and etat3 == 1):  #si appuyer sur BTN4 = non
                        print("echec !")
                        break  #fin exercice et en redemander un (peut etre demander avant de remonter)
                break

            elif (etat2 == 0 and etat1 == 1):
                print("demande exo")
                break
            elif (etat3 == 0 and etat4 == 1 and etat1 == 1 and etat2 == 1):
                exit()
                break
            else:
                print("attente")

            time.sleep(0.5)
            tabCouleurs = []  #remise à zero du tableau
            juste = 0

    print("end")
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
Beispiel #16
0
#     plexer = Multiplex(bus)
#     plexer.channel(address, 2)

from time import sleep
import board
import busio
import adafruit_tsl2591
import adafruit_tcs34725
import adafruit_tca9548a

# print(board.SCL)
i2c = busio.I2C(board.SCL, board.SDA)
tca = adafruit_tca9548a.TCA9548A(i2c)
# print(tca[0].tca.__dict__.values)

tcs = adafruit_tcs34725.TCS34725(tca[0])
tcs.gain = 60
tcs.integration_time = 100

tsl = adafruit_tsl2591.TSL2591(tca[1])
tsl.gain = adafruit_tsl2591.GAIN_LOW
tsl.integration_time = adafruit_tsl2591.INTEGRATIONTIME_100MS

while True:
    print('lux:              ', round(tsl.lux, 1))
    print('color_raw:        ', tcs.color_raw)
    print('color_rgb_bytes:  ', tcs.color_rgb_bytes)
    # print('color_temperature:', round(tcs.color_temperature, 1))
    print()
    sleep(2)
led3 = RGBLED(16,20,21)             # RGB LED3 PINS: RED PIN 36, GREEN PIN 38, BLUE PIN 40
ledArray = [led1,led2,led3]
ledColorCycle = [(1,0,0),(0,1,0),(0,0,1)]

i2c = busio.I2C(board.SCL, board.SDA)
mpx = adafruit_tca9548a.TCA9548A(i2c) # multiplexer
mpx_channels = [3,4,5]
sensorArray = []

ledTest = False
mpxTest = False
rgbSensorTest = True

if mpxTest or rgbSensorTest:
    for mpx_channel in mpx_channels:
        sensorArray.append(adafruit_tcs34725.TCS34725(mpx[mpx_channel]))
        print("Initialized mpx channel",str(mpx_channel),)

def getColorRange(trys):
    currentTry = 0
    sensorArray = []
    reds = []
    greens = []
    blues = []
    for mpx_channel in mpx_channels:
        sensorArray.append(adafruit_tcs34725.TCS34725(mpx[mpx_channel]))
    while currentTry < trys:
        for sensor in sensorArray:
            reds.append(sensor.color_rgb_bytes[0])
            greens.append(sensor.color_rgb_bytes[1])
            blues.append(sensor.color_rgb_bytes[2])
 def __init__(self, i2c_bus):
     self.color_sensor = adafruit_tcs34725.TCS34725(i2c_bus)
Beispiel #19
0
 def __init__(self, bus):
     self.sensor = adafruit_tcs34725.TCS34725(bus)
 def __init__(self, i2c_bus):
     self.color_sensor = adafruit_tcs34725.TCS34725(i2c_bus)
     self.color_sensor.gain = 60
     self.mult = pow((128 / 60), 0.6)
Beispiel #21
0
from gpiozero import LED

# ---------------- CONFIG ----------------
TD_DIRECTORY_ADDRESS = "http://172.16.1.100:8080"
LISTENING_PORT = 8080
DEFAULT_ENABLE = 17

td = 0
app = Flask(__name__)
led = LED(DEFAULT_ENABLE)
led.on()

# Create sensor object, communicating over the board's default I2C bus
i2c = board.I2C()  # uses board.SCL and board.SDA
sensor = adafruit_tcs34725.TCS34725(i2c, address=0x29)


@app.route("/")
def thing_description():
    return json.dumps(get_td(ip_addr)), {'Content-Type': 'application/json'}


@app.route("/properties/color", methods=["GET"])
def color():
    rgb = sensor.color_rgb_bytes
    return json.dumps(rgb), {'Content-Type': 'application/json'}


@app.route("/properties/temperature", methods=["GET"])
def temperature():
Beispiel #22
0
        return (50 >= c > 16 and 24 >= r > 7)

    @property
    def yellow(self):
        r, g, b, c = self.sensor.color_raw
        return (c > 50 and r > 24)


if __name__ == "__main__":
    try:
        read_buff = bytearray(16)
        loop_count = 0

        with busio.I2C(board.SCL, board.SDA) as bus:
            mux = adafruit_tca9548a.TCA9548A(bus)
            rgb_left = adafruit_tcs34725.TCS34725(mux[7])
            rgb_center = adafruit_tcs34725.TCS34725(mux[6])
            rgb_right = adafruit_tcs34725.TCS34725(mux[5])

            while 1:
                #read rgbs
                rl, gl, bl, cl = rgb_left.color_raw
                rc, gc, bc, cc = rgb_center.color_raw
                rr, gr, br, cr = rgb_right.color_raw
                if loop_count % 4 == 0:
                    print(f'Left:  R:{rl} G:{gl} B:{bl} C:{cl}')
                    print(f'Center: R:{rc} G:{gc} B:{bc} C:{cc}')
                    print(f'Right: R:{rr} G:{gr} B:{br} C:{cr}')
                time.sleep(0.24)
                loop_count += 1
    except KeyboardInterrupt:
Beispiel #23
0
def main():
    phraseTest = ""
    phrase = ""
    matriceCouleurs = [[]]
    matriceCouleursTest = [["Noir", "Bleu"], ["Rouge", "Marron"], ["Noir", "Noir"], ["Rouge", "Noir"], ["Jaune", "Noir"]]
    tabCouleurs = []
    liste = []
    liste2 = []
# création instance
    filin = open("fichierCouleurs.txt", "a")

    i2c = busio.I2C(board.SCL, board.SDA)
    tca = adafruit_tca9548a.TCA9548A(i2c)
    # erreur viens de l'adresse donner en parametres
    #tca2 = adafruit_tca9548a.TCA9548A(i2c, 0x71)

#création des capteurs en tableau avec affectation valeurs utilisable
    for x in range(0, 2):
        liste.append(adafruit_tcs34725.TCS34725(tca[x]))
        liste[x].gain = 16
        liste[x].integration_time = 200

    print("Chaque capteur possède un gain = 16 et un temps d'intégration = 200ms")
# récupération data et test de la couleurs qui lui est lié
    for x in range(0, 2):
        data = liste[x].color_raw
        dataLux = liste[x].lux
        print("data0 = ", data)
        print("Luminosité0 = ", dataLux)
        tabCouleurs.append(testCouleurs(data))
        with open("fichierCouleurs.txt", "a") as filout:
            filout.write("\n"+str(data)+tabCouleurs[x])

# changement multiplexeur
    tca = adafruit_tca9548a.TCA9548A(i2c, 0x71)

    for x in range(0, 2):
        liste2.append(adafruit_tcs34725.TCS34725(tca[x]))
        liste2[x].gain = 16
        liste2[x].integration_time = 200

    for x in range(0, 2):
        data1 = liste2[x].color_raw
        dataLux1 = liste2[x].lux
        print("data1 = ", data1)
        print("Luminosité1 = ", dataLux1)
        tabCouleurs.append(testCouleurs(data1))
        with open("fichierCouleurs.txt", "a") as filout:
            filout.write("\n" + str(data1) + tabCouleurs[x])

    print(tabCouleurs)
#remplissage matrice couleurs
    matriceCouleurs = [tabCouleurs[i:i+2] for i in range(0, 4, 2)]
# on fait la range avec le pas que l'on souhaite
    print(matriceCouleurs)

    phrase += testCaractere(matriceCouleurs)
    print(phrase)

    for x in range(5):
        tabCouleurs2 = matriceCouleursTest[x]
        phraseTest += testCaractereTest2(tabCouleurs2)

    tabCouleurs2 = matriceCouleursTest[0]
    print(eval(phraseTest))
Beispiel #24
0
import time
import board
import busio
import adafruit_tcs34725
i2c = busio.I2C(board.SCL, board.SDA)
sensor = adafruit_tcs34725.TCS34725(i2c)
while True:
    temp = sensor.color_temperature
    lux = sensor.lux
    print('Temperature: {0}K Lux: {1}'.format(temp, lux))
    print('Color: ({0}, {1}, {2})'.format(*sensor.color_rgb_bytes))
    time.sleep(5.0)

Beispiel #25
0
    def _initialize_color_sensor(self):
        """
        Initialize only the Color Sensor
        """

        self.color_sensor = adafruit_tcs34725.TCS34725(self.i2c)