Skip to content

Instantly share code, notes, and snippets.

View awonak's full-sized avatar

Adam Wonak awonak

View GitHub Profile
var task_counter = 0;
task = function() {
return {
add: function(numberToAdd) {
if (numberToAdd < 10) {
task_counter = task_counter + numberToAdd;
}
else {
@awonak
awonak / button.py
Last active December 30, 2021 21:48
Demonstration of an async long press button handler
# Author: Adam Wonak
# Copyright Adam Wonak 2021 Released under the MIT license
# Based on Kevin Köck and Peter Hinch's work.
# Source: https://github.com/kevinkk525/pysmartnode/blob/master/pysmartnode/utils/abutton.py
# Source: https://github.com/peterhinch/micropython-async/blob/master/v3/primitives/pushbutton.py
# Refactored to expect use of long press, removed double click, improved readability and docstrings.
# Created on 2019-10-19
# Updated 2021-09-04
__updated__ = "2021-09-04"
@awonak
awonak / main.py
Last active October 14, 2021 02:04
EuroPi Bootloader Script Example
## Each script defined in its own file. This is a generic example script.
class ExampleScript:
def __init__(self, name: str):
self.name = name
def run(self):
while True:
print("Running {}".format(self.name))
sleep_ms(500)
@awonak
awonak / clock_test.c
Last active August 21, 2022 18:15
Experiment in building a EuroPi script using the Pico C/C++ SDK (https://imgur.com/a/jjSMy6P)
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include "pico/stdlib.h"
#include "pico/time.h"
#include "hardware/adc.h"
#include "hardware/gpio.h"
#include "hardware/i2c.h"
#include "hardware/pwm.h"
@awonak
awonak / main.go
Created February 28, 2023 04:51
Uncertainty TinyGo test script
package main
import (
"log"
"machine"
"math"
"time"
)
const (
@awonak
awonak / digital_vco.go
Created March 3, 2023 06:23
You really think someone would do that, just turn the Uncertainty into a quantized digital oscillator?
package main
import (
"log"
"machine"
"math"
"time"
"tinygo.org/x/drivers/tone"
)
@awonak
awonak / generative_seq.ino
Last active August 17, 2023 08:30
Generative sequencer firmware for the Hagiwo Sync LFO.
// Install the "AVR Standard C Time Libaray", used for faster PWM frequencies
// and smoother analog cv output.
#include <avr/io.h>
// GPIO Pin mapping for knobs and jacks.
#define P1 0 // Probability
#define P2 1 // Sequence step length
#define P3 3 // Amplitiude
#define P4 5 // Refrain count
@awonak
awonak / multi_mode_eg.ino
Last active April 29, 2023 20:42
Multi-mode Envelope Generator firmware for HAGIWO Sync Mod LFO
/**
* @file multi_mode_eg.ino
* @author Adam Wonak (https://github.com/awonak/)
* @author Hagiwo (https://note.com/solder_state/n/n69643b792274)
* @brief Multi-mode Envelope Generator firmware for HAGIWO Sync Mod LFO (demo: TODO)
* @version 0.2
* @date 2023-04-19
*
* @copyright Copyright (c) 2023
*