Skip to content

Instantly share code, notes, and snippets.

View tyeth's full-sized avatar

Tyeth Gundry tyeth

  • Bristol, UK
  • 17:19 (UTC +01:00)
View GitHub Profile
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
@Timo614
Timo614 / funhouse.yaml
Created April 11, 2024 15:58
Adafruit funhouse esphome starter config
# 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:
@anecdata
anecdata / espnow_receiver.py
Last active February 11, 2024 22:56
CircuitPython example for Espressif ESP-NOW protocol
# SPDX-FileCopyrightText: 2023 anecdata
#
# SPDX-License-Identifier: MIT
import time
import traceback
import supervisor
import os
import rtc
import espnow
@helgibbons
helgibbons / enviroplus_into_adafruitio.py
Last active February 23, 2024 14:53
Enviro + into adafruit.io
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
@benevpi
benevpi / soilmoisture.ino
Created August 27, 2020 13:41
A sketch for reading soil moisture levels and using Deep Sleep to preserve battery life on DIY More ESP32 soil boards
#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";
@fnky
fnky / ANSI.md
Last active July 22, 2024 12:03
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@savetheclocktower
savetheclocktower / README.md
Last active May 18, 2024 10:05
Using a rotary encoder as a volume control for the Raspberry Pi

Using a rotary encoder as a volume control

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.

Rotary encoder

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.

@gweinhold
gweinhold / azure.cs
Created September 10, 2015 20:29
Workaround for Azure Webjobs in development machine.
public static void Main(string[] args)
{
#if DEBUG
GetJobsFromQueue();
#else
var host = new JobHost();
host.RunAndBlock();
#endif
}
@exit99
exit99 / cool_script.py
Created December 15, 2014 17:52
Running python scripts with postfix
# Be sure to chmod +x
#!/usr/bin/env python
import email
import json
import sys
import requests