Skip to content

Instantly share code, notes, and snippets.

@stonehippo
stonehippo / update_circuitpy.sh
Created September 4, 2023 20:08
shell script to update CircuitPython build files
cd ~/circuitpython
git pull
git submodule sync
git submodule update --init
cd $OLDPWD

Hallowing M4 & touchio

The Adafruit Hallowing M4 is a feature-filled development board, including four capacitve touch "teeth" at the bottom of it's skull-shaped circuit board.

CircuitPython has a nifty module for working cap touch pins, touchio. However, the Hallowing M4 uses an Atmel SAMD51, which doesn't handle cap touch in hardware (unlike the SAMD21 in the Hallowing M0). If you try to use the cap touch pins without some additional setup, you'll get an error.

import board
import touchio
@stonehippo
stonehippo / arm-toolchains.md
Last active April 25, 2023 16:15
ARM Embedded Toolchains

ARM Embedded Toolchains

GNU toolchain from ARM

This is the canonical place to get the GNU GCC toolchain for ARM Embedded. For detailed info, see https://developer.arm.com/open-source/gnu-toolchain. Installers for Windows, Linux 64 bit and MacOS 64 bit, plus a source tarball.

https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads (this page has been deprecated, but is still available and has older versions)

https://developer.arm.com/Tools%20and%20Software/GNU%20Toolchain (newer page)

@stonehippo
stonehippo / external.js
Created April 5, 2012 18:08
Invoking an inline Javascript that has a dependency on an deferred external lib
// If defer is working, this won't execute until the page has loaded
console.log('starting external...');
// Put in a something that takes some time, to simulate a large library load
for (var really_big_number = 10000000;really_big_number--;) {
really_big_number;
}
External = {
'wow': function() {
console.log('Wowsers!');
@stonehippo
stonehippo / SimpleAudioFXTrigger.ino
Last active December 19, 2022 03:21
A simple Arduino trigger of the Adafruit Audio FX Sound Board
// A simple trigger for the Adafruit Audio FX Sound Board
// For complete info on the sound board, see https://learn.adafruit.com/adafruit-audio-fx-sound-board/overview
/*
This is a simple test of a direct trigger of the Audio FX Sounds Board from an Arduino.
For my test, I used an Arduino Pro Mini running at 3.3v & 8mHz. Digital pin #4 of the Arduino
was connected to trigger pin #0 of the Sound Board, and I tied them to a common ground. I powered
Sound Board via a USB external battery for the initial tests, and the Arduino via the FTDI cable.
For later tests, I powered the Sound Board via the Arduino's VCC (3v) pin directly.
@stonehippo
stonehippo / LICENSE
Last active November 9, 2022 20:00
A class for the SparkFun moto:bit for use with BBC micro:bit micro python
MIT License
Copyright (c) 2022 George White
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@stonehippo
stonehippo / README.md
Last active October 27, 2022 21:22
Zsh aliases for managing Ardupy

Zsh aliases for Ardupy

Zsh aliases for an installation of Ardupy using a Python virtualenv set up using pyenv.

It looks like Seeed has suspended development of Ardupy. It's been a while since anything was contributed, and they've archived the public repos.

Aliases

Alias Command Notes
@stonehippo
stonehippo / knock_knock.ino
Last active August 26, 2022 14:13
A simple Arduino piezo knock sensor that cycles through a series of RGB LED patterns
// define pins for the RGB LED
byte led_red_pin = 3;
byte led_green_pin = 5;
byte led_blue_pin = 6;
int piezo_pin = A0;
int piezo_threshold = 250; // This may have to be tuned for your piezo
int wait = 10000; // the time before the last night and the cycle resets
int debounce = 200; // the number of milliseconds we'll wait to reject bad input
@stonehippo
stonehippo / ssd1306_I2C_setup.py
Last active August 23, 2022 20:27
Basic setup of an SSD1306-based I2C display using CircuitPython Display
import board
import displayio
import terminalio
import adafruit_displayio_ssd1306
from adafruit_display_text import label
from adafruit_displayio_layout.layouts.grid_layout import GridLayout
# release any displays that have already been set up
displayio.release_displays()
@stonehippo
stonehippo / pseudo-screamer.ino
Created August 8, 2022 02:19
A quick test of the screamer
#define SOUND_TRIGGER 9 // the pin attached to a trigger on the sound FX board
void setup() {
Serial.begin(9600);
pinMode(LED_BUILTIN, OUTPUT);
// set up the pin for the sound trigger, including pulling it high
pinMode(SOUND_TRIGGER, OUTPUT);
digitalWrite(SOUND_TRIGGER, HIGH);