Open the serial console to see the results! The code prints out an array of addresses. Because I2C typically refers to addresses in hex form, we've included this bit of code that formats the results into hex format. Last, we have the loop that runs the actual scan, i2c_scan(). So next we include a loop that waits until I2C is locked and then continues on to the scan function. To be able to scan it, we need to lock the I2C down so the only thing accessing it is the code. No matter how many times you call board.I2C(), it will return the same object. If the object has already been created, then the existing object is returned. ![]() This convenience routine creates and saves a busio.I2C object using the default pins board.SCL and board.SDA. # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industriesįirst we create the i2c object, using board.I2C(). ,įinally: # unlock the i2c bus when ctrl-c'ing out of the loop # i2c = busio.I2C(board.GP1, board.GP0) # Pi Pico RP2040 # i2c = busio.I2C(board.SCL1, board.SDA1) # QT Py RP2040 STEMMA connector # i2c = board.STEMMA_I2C() # For using the built-in STEMMA QT connector on a microcontroller I2c = board.I2C() # uses board.SCL and board.SDA # If you run this and it seems to hang, try manually unlocking """CircuitPython I2C Device Address Scan""" The blue wire connects from SDA on the TSL2591 to SDA on your board.Ĭheck out the list below for a diagram of your specific board!Ĭopy Code # SPDX-FileCopyrightText: 2017 Limor Fried for Adafruit Industries.The yellow wire connects from SCL on the TSL2591 to SCL on your board.The red wire connects from VIN on the TSL2591 to power on your board.The black wire connects from GND on the TSL2591 to ground on your board.In these diagrams, the wire colors match the STEMMA QT cables and connect to the same pins on each board. We've included diagrams show you how to connect the TSL2591 to your board. No further soldering required!įor Gemma M0, Circuit Playground Express and Circuit Playground Bluefruit, you can use use the STEMMA QT to alligator clips cable to connect to the TSL2591.įor Trinket M0, Feather M0 and M4 Express, Metro M0 and M4 Express and ItsyBitsy M0 and M4 Express, you'll need a breadboard and STEMMA QT to male jumper wires cable to connect to the TSL2591.įor QT Py M0, you'll need a STEMMA QT cable to connect to the TSL2591. ![]() The TSL2591 comes with STEMMA QT / QWIIC connectors on it, which makes it super simple to wire it up. ![]() You'll need a couple of things to connect the TSL2591 to your board.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |