AdaFruit Ecosystem

From Colettapedia
Jump to navigation Jump to search

CircuitPython

Docs/Learning Resources

General

  • ls /dev/tty.*
  • screen /dev/tty.blahblah
  • /lib is in sys.path by default
  • help( "modules" )
  • array.array - single types specified by typecode character at runtime
  • collections.namedTuple - a fixed sized dict without the
  • gc.mem_alloc() shows RAM used, gc.mem_free() shows memory available
  • boot.py runs BEFORE USB is setup, outputs to boot_out.txt
  • globals() to show what modules are loaded - can't unload modules

Installation

  1. Download latest version of circuitpython for the given board
  2. Tap reset button twice to enter UF2 (USB Flasher version 2) bootloader. A new drive shows up on your computer called boardnameBOOT, e.g., TRINKETBOOT
  3. Drag uf2 file into there and this will trigger board to reboot

CircuitPython Essentials tutorial

Analog Out

"""CircuitPython Analog Out example"""
import board
from analogio import AnalogOut

analog_out = AnalogOut(board.A0)

while True:
   # Count up from 0 to 65535, with 64 increment
   # which ends up corresponding to the DAC's 10-bit range
   for i in range(0, 65535, 64):
       analog_out.value = i

Adafruit CircuitPython Library

Bundle

  • A bundle of useful CircuitPython libraries ready to use from the filesystem ONLY for use on boards that have extra flash storage.
  • Github repo - download the latest. Contains precompiled .mpy files that your copy over to /lib
  • Documentation - Includes SD card usage utility, etc

Individual Library Installation

  • For smaller boards you must copy the libraries manually
    • See CircuitPython Libraries for more info.
    • Create a lib folder on your CIRCUITPY drive and copy the files into there manually.

MicroPython/CircuitPython 3rd party libraries

ulab

  • ulab is a numpy-like array manipulation library for micropython and CircuitPython
  • ulab github
  • ulab docs

Adafruit IO

  • A data logging service that you can hit from you IoT device

Trinket M0

Specs

  • microchip - SAMD21 32-bit Cortex M0+
  • CPU speed - 48MHz
  • Program memory size - 256KB flash
  • RAM - 32KB
  • Builtin Green ON LED
  • Builtin red LED on pin #13
  • Builtin RGB DotStar LED
  • 5 GPIO pins

Reference

Downloads

Metro M4 Express

  • Cortex M4 core running at 120 MHz
  • Floating point support with Cortex M4 DSP instructions
  • 512 KB flash, 192 KB RAM
  • 32-bit, 3.3V logic and power
  • Dual 1 MSPS DAC (A0 and A1)
  • Dual 1 MSPS ADC (8 analog pins)
  • 6 x hardware SERCOM (I2C, SPI or UART)
  • 22 x PWM outputs
  • Stereo I2S input/output with MCK pin
  • 10-bit Parallel capture controller (for camera/video in)
  • Built in crypto engines with AES (256 bit), true RNG, Pubkey controller
  • 64 QFN (Quad-flat no-leads)

Available UART Combos