I've moved the journal and code for fungen to the Pico Code Project on GitHub.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
""" | |
Convert a note pitch like A#4 to its frequency. | |
""" | |
# Generate a unique pitch for a note based on its pitch class and octave. | |
def name(pitch_class: str, octave: int) -> str: | |
return f"{pitch_class}{octave}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ***WARNING*** | |
# Running this file will delete all files and directories from the micropython device it's running on | |
# If you run keep_this=False it will delete this file as well. | |
# see https://docs.micropython.org/en/latest/library/os.html for os function list | |
import os | |
def _delete_all(directory='.', keep_this=True): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# capture wordcounts in dayfile | |
# invoke with project root as argument; default is (currently) start-apl | |
# assumes book contents are markdown files in the `manuscript` directory | |
# creates a `progress` direectory if necessary | |
# writes wordcounts (using wc) for each markdown file and totals in a file whose name is based on today's date | |
_project=${1:-start-apl} | |
cd ~/git/active/$_project/ | |
_now=$(date +"%Y%m%d") | |
mkdir -p progress |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import xml.etree.ElementTree as ET | |
import html2text | |
def convert(enex_file_name: str, markdown_file_name: str) -> None: | |
enex = ET.parse(enex_file_name) | |
root = enex.getroot() | |
note = root.find('note') | |
html = note.find('content').text | |
text = html2text.html2text(html) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
MicroPython code to read and write from UART1 on the Pico | |
UART0 is not available as it is used for the REPL. | |
To test, you can use a 3V3 FTDI cable or similar device that connects a host computer with the Pico. | |
NB: Make sure it's a 3V3 cable, not a 5V cable, or you could kill your PIco!! | |
Connect FTDI black to Pico GND. |
I've moved the journal and code for the 'scope to the Pico Code Project on GitHub.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Example for remote control from host via Serial link. | |
This is the code to run on the Pico. | |
It sets up the onboard LED and allows you to turn it on or off. | |
""" | |
from machine import Pin | |
# use onboard LED which is controlled by Pin 25 | |
# on a Pico W the onboad lLED is accessed differently, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
class Talker: | |
TERMINATOR = '\r'.encode('UTF8') | |
def __init__(self, timeout=1): | |
self.serial = serial.Serial('/dev/ttyACM0', 115200, timeout=timeout) | |
def send(self, text: str): |
I first met APL (A Programming Language) in 1968.
I've always used it a lot, and now I use it every day.
Many developers will never have heard of the language. Many of those that have, either love it (as I do) or hate it.
I think now is the time to explain what APL is, why I use it so often, and why I think that developers should take a look at it.
NewerOlder