Skip to content

Instantly share code, notes, and snippets.

@apendley
apendley / code.py
Last active July 29, 2021 14:54
Revised tone player from https://learn.adafruit.com/adafruit-macropad-rp2040/macropad-tone (Use the project bundle, and just replace code.py)
from rainbowio import colorwheel
from adafruit_macropad import MacroPad
macropad = MacroPad()
# We'll show the pixels manually
macropad.pixels.auto_write = False
# Notes for each key
tones = [196, 220, 246, 262, 294, 330, 349, 392, 440, 494, 523, 587]
@apendley
apendley / cmodule_tests.codeaproject
Last active December 17, 2015 10:19
cmodule_tests: simple tests and examples of cmodule usage. Requires the cmodule project as a Codea dependency, located at: https://gist.github.com/apendley/5411561
--# Main
-- Main
-- tests current as of version 0.1.0
function setup()
-- initialize cmodule with the name of this project.
-- note the syntactic sugar: when calling a function that
-- takes a string literal as it's only argument, the parenthesis
@apendley
apendley / cmodule.codeaproject
Last active December 16, 2015 09:18
Work in progress on a module system designed for Codea
--# cmodule
-- cmodule
-- v0.1.1
-- todo:
-- * document
-- * look for optimizations
-- * investigate better ways to handle dependency cycles
-- * support exported projects
@apendley
apendley / tparameter.codeaproject
Last active December 16, 2015 07:49
tparameter, a libary for Codea that allows parameters to be bound to arbitrary tables (as opposed to only _G, which is all Codea's parameter function allows). Project contains the tparameter class, as well as the Timer class, which is used by the example code. See Main and Ellipse for many examples of how to use tparameter. See http://twolivesle…
--# tparameter
-- tparameter
-- v1.0.2
local _updateRate = 1/60
local _refreshDelay = 1/60
local _reloadSteps, _reloadStepInterval = 4, 1
local _chooseParam = 'choose_object_to_inspect'
local _selectParam = 'SELECT'
local _chooseWatchParam = 'object_parameter_inspector'
@apendley
apendley / timing.codeaproject
Last active December 16, 2015 05:09
Lua Timing classes compatible with Codea
--# Main
-- Main
function setup()
timer = createTimer()
scheduler = createScheduler()
timer(.5, 0, function(t) print('timer:', t.elapsed) end)
timer(1, 1, function(t, ...) print('Hello', ...) end, 'Aaron!')