Standard escape codes are prefixed with Escape
:
- Ctrl-Key:
^[
- Octal:
\033
- Unicode:
\u001b
- Hexadecimal:
\x1B
- Decimal:
27
typedef float mp_float_t; | |
typedef struct { mp_float_t c, s; } sincos_result; | |
// Compute sin and cos of (x+1)*pi/4, -1 < x < 1 to about 4.5 places | |
/* polynomials from | |
```py | |
import numpy as np | |
from numpy.polynomial.polynomial import Polynomial |
from math import sin | |
import sdcardio | |
import storage | |
import audiobusio | |
import audiocore | |
import audiomixer | |
import audiomp3 | |
import board | |
import time | |
import math |
# Thanks to this configuration for the initial legwork https://github.com/kbx81/esphome-configs/blob/main/dev/esp-funhouse.yaml | |
esphome: | |
name: funhouse | |
friendly_name: Funhouse | |
platformio_options: | |
board_build.mcu: esp32s2 | |
board_build.variant: esp32s2 | |
esp32: |
# SPDX-FileCopyrightText: 2023 anecdata | |
# | |
# SPDX-License-Identifier: MIT | |
import time | |
import traceback | |
import supervisor | |
import os | |
import rtc | |
import espnow |
import time | |
from machine import Pin, ADC, UART | |
from picographics import PicoGraphics, DISPLAY_ENVIRO_PLUS | |
from pimoroni import RGBLED, Button | |
from breakout_bme68x import BreakoutBME68X, STATUS_HEATER_STABLE | |
from pimoroni_i2c import PimoroniI2C | |
from breakout_ltr559 import BreakoutLTR559 | |
from pms5003 import PMS5003 | |
import WIFI_CONFIG | |
from network_manager import NetworkManager |
#include "DHT.h" | |
#include "esp_wifi.h" | |
#include <WiFi.h> | |
#include <ArduinoJson.h> | |
#include <HTTPClient.h> | |
//move to secrets | |
const char * networkName = "XXX"; | |
const char * networkPswd = "XXX"; | |
String AIOKey = "XXX"; |
On my RetroPie machine I wanted a hardware volume knob โ the games I play use a handful of emulators, and there's no unified software interface for controlling the volume. The speakers I got for my cabinet are great, but don't have their own hardware volume knob. So with a bunch of googling and trial and error, I figured out what I need to pull this off: a rotary encoder and a daemon that listens for the signals it sends.
A rotary encoder is like the standard potentiometer (i.e., analog volume knob) we all know, except (a) you can keep turning it in either direction for as long as you want, and thus (b) it talks to the RPi differently than a potentiometer would.
I picked up this one from Adafruit, but there are plenty others available. This rotary encoder also lets you push the knob in and treats that like a button press, so I figured that would be useful for toggling mute on and off.
public static void Main(string[] args) | |
{ | |
#if DEBUG | |
GetJobsFromQueue(); | |
#else | |
var host = new JobHost(); | |
host.RunAndBlock(); | |
#endif | |
} | |
# Be sure to chmod +x | |
#!/usr/bin/env python | |
import email | |
import json | |
import sys | |
import requests |