Skip to content

Instantly share code, notes, and snippets.

@tomoto
tomoto / JabaraMIDI.pde
Last active September 17, 2022 23:24
蛇腹MIDIコントローラー / Accordion-like MIDI Controller https://qiita.com/tomoto335/items/92580af26b5c171dc1c0
// ライブラリに The Midibus と G4P を追加すること
import themidibus.*;
import g4p_controls.*;
import processing.serial.*;
String midiOut = "JabaraMIDI"; // 出力先MIDIループバックデバイス名(loopMIDIでこの名前の仮想MIDIデバイスを作っておく)
String serialIn = "COM4"; // センサーデータを読み取る(Arduinoが接続されている)シリアルポート
int midiChannel = 0; // MIDIチャンネル(0-based)
int midiControlNumber = 7; // 送信するCC(コントロールチェンジ)のControl Number
@tomoto
tomoto / listen-for-shutdown.py
Last active January 20, 2022 08:05
Raspberry Pi Shutdown Button
#!/usr/bin/env python
import RPi.GPIO as GPIO
import subprocess
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
@tomoto
tomoto / fonts.ino
Last active June 8, 2021 18:50
Generate M5StickC font sample image
#include <M5StickC.h>
void setup() {
M5.begin();
M5.Lcd.setRotation(3);
Serial.begin(115200);
}
void renderText(TFT_eSprite& s, int font, const GFXfont* freeFont) {
s.setTextColor(WHITE);
@tomoto
tomoto / M5Stack_Atom_LED_Example.cpp
Created July 10, 2020 09:52
M5Stack Atom Matrix LED example (without M5Atom library that causes flicker)
#include <FastLED.h>
const int NUM_LEDS = 25;
const int LED_PIN = 27;
static CRGB leds[NUM_LEDS];
CRGB correct(CRGB c) {
// fix RGB order :(
return CRGB(c.g, c.r, c.b);
}
@tomoto
tomoto / code.py
Last active July 10, 2020 23:27
Estimated WBGT meter (25±3℃) for CircuitPython on Particle Xenon
import time
import board
import pulseio
from adafruit_motor import servo
from adafruit_dht import DHT11
from collections import namedtuple
StatusLED = namedtuple('StatusLED', ['r', 'g', 'b'])
led = StatusLED(
pulseio.PWMOut(board.RGB_LED_RED, frequency=5000, duty_cycle=65535),
@tomoto
tomoto / ffserver.conf
Created December 31, 2018 18:38
FFServer settings to "clean up"Parrot Mambo
HTTPPort 8090
HTTPBindAddress 0.0.0.0
MaxHTTPConnections 2000
MaxClients 1000
MaxBandwidth 6000
CustomLog -
<Feed feed1.ffm>
File /tmp/feed1.ffm
FileMaxSize 5M
@tomoto
tomoto / mambo_mqtt.py
Last active December 22, 2017 12:48
Controlling drone by MQTT
#!/usr/bin/env python
import logging
logging.basicConfig(level=logging.DEBUG)
logger = logging.getLogger("main")
# Mambo
from Mambo import Mambo
import random