Wednesday 30 March 2022

Adafruit RP2040 QT Trinkey woes and working example

 Having just bought one of these potentially delightful devices, I now find myself in the wilderness of getting started.

I got past Hello World and then thought I would try using the NeoPixel.

https://www.adafruit.com/product/5056

with 'white' buttons

Product is listed as 

Adafruit Trinkey QT2040 - RP2040 USB Key with Stemma QT


Here's how to get started..


#1 load the latest firmware

https://www.adafruit.com/product/5056

with 'white' buttons

circuit python port

https://circuitpython.org/downloads

the only trinkey with PI is

https://circuitpython.org/board/adafruit_qt2040_trinkey/

So lets get the firmware..

You get linked to..

https://adafruit-circuit-python.s3.amazonaws.com/index.html?prefix=bin/adafruit_qt2040_trinkey/en_GB/

take the top uf2

I used

https://adafruit-circuit-python.s3.amazonaws.com/bin/adafruit_qt2040_trinkey/en_GB/adafruit-circuitpython-adafruit_qt2040_trinkey-en_GB-20220329-07f8ceb.uf2

hold down both buttons then drag the file into RPI-RP2 folder

Now you will need the library

(https://circuitpython.org/libraries)

copy the lib folder over


Eventually I got it working with the following code

# SPDX-FileCopyrightText: 2018 Kattni Rembor for Adafruit Industries

# SPDX-License-Identifier: MIT

print("hello")

"""CircuitPython Essentials NeoPixel RGBW example"""

import time

import board

import neopixel

#import digitalio

pixel_pin = board.NEOPIXEL

num_pixels = 1

#print(neopixel.__version__, neopixel.__file__)

pixel = neopixel.NeoPixel(board.NEOPIXEL, 1)

pixel.brightness = 0.01

#print(pixel)

ps=0.2

#ps=1

while True:

    #BRG

    pixel.fill((0, 0, 255))

    pixel.brightness = 0.05

    time.sleep(ps)

    pixel.brightness = 0.01

    pixel.fill((255, 0, 255))

    time.sleep(ps)

    pixel.fill((255, 255, 255))

    time.sleep(ps)

    pixel.fill((255, 255, 0))

    time.sleep(ps)

    pixel.fill((0, 255, 0))

    time.sleep(ps)   

    pixel.fill((0, 0, 0))

    time.sleep(ps)

#test = pixel[0].getPixelColor()

#pixel.fill((125, 0, 1))

pixel.show()

#pixel.fill(255,0,0)

#pixel = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.3, auto_write=False)

print("goodbye")




No comments:

Post a Comment