Datasheet
But you probably want to do a little more, lets log the temperature from the chip to a file.
Here's the new script
When saved, the Trinket will start saving the temperature once per second to the SD card under the
import adafruit_sdcard
import microcontroller
import busio
import digitalio
import board
import storage
import os
import time
# Use any pin that is not taken by SPI
SD_CS = board.D0
led = digitalio.DigitalInOut(board.D13)
led.direction = digitalio.Direction.OUTPUT
# Connect to the card and mount the filesystem.
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
cs = digitalio.DigitalInOut(SD_CS)
sdcard = adafruit_sdcard.SDCard(spi, cs)
vfs = storage.VfsFat(sdcard)
storage.mount(vfs, "/sd")
# Use the filesystem as normal! Our files are under /sd
print("Logging temperature to filesystem")
# append to the file!
while True:
# open file for append
with open("/sd/temperature.txt", "a") as f:
led.value = True # turn on LED to indicate we're writing to the file
t = microcontroller.cpu.temperature
print("Temperature = %0.1f" % t)
f.write("%0.1f\n" % t)
led.value = False # turn off LED to indicate we're done
# file is saved
time.sleep(1)
© Adafruit Industries https://learn.adafruit.com/adafruit-adalogger-featherwing Page 33 of 36