I can't seem to get it to show the values in Mu editor or in Mac OSX screen...
But I put together a python file on my local and I am trying to connect to the trinkey and print some json using the example and ran it but returned another error that that port is busy:
Code: Select all
# SPDX-FileCopyrightText: 2021 Carter Nelson for Adafruit Industries
#
# SPDX-License-Identifier: MIT
import json
import serial
# open serial port (NOTE: change location as needed)
ss = serial.Serial("/dev/tty.usbmodem14601")
# read string
_ = ss.readline() # first read may be incomplete, just toss it
raw_string = ss.readline().strip().decode()
# load JSON
data = json.loads(raw_string)
# print data
print("CO2 =", data['CO2'])
print("pressure =", data['pressure'])
print("temperature =", data['temperature'])
print("humidity =", data['humidity'])
Traceback (most recent call last):
File "/Library/Python/3.8/site-packages/serial/serialposix.py", line 322, in open
self.fd = os.open(self.portstr, os.O_RDWR | os.O_NOCTTY | os.O_NONBLOCK)
OSError: [Errno 16] Resource busy: '/dev/tty.usbmodem14601'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "trinkey.py", line 9, in <module>
ss = serial.Serial("/dev/tty.usbmodem14601")
File "/Library/Python/3.8/site-packages/serial/serialutil.py", line 244, in __init__
self.open()
File "/Library/Python/3.8/site-packages/serial/serialposix.py", line 325, in open
raise SerialException(msg.errno, "could not open port {}: {}".format(self._port, msg))
serial.serialutil.SerialException: [Errno 16] could not open port /dev/tty.usbmodem14601: [Errno 16] Resource busy: '/dev/tty.usbmodem14601'
Really not sure what I am doing wrong but I think that the Trinkey firmware never properly loaded. I did the flash_nuke.uf2,
Afterwork I'll try again. I'll flash nuke it again and try to insert the trinkey with the Boot being pressed and then apply the u2if_trinkey_qt2040_rp2040.uf2 because ultimately I want to allow direct reading with u2if...
I've been googling a bit trying to find more information how to free up that port resource or kill that process via command line but coming up with nothing ... :-\