Skip to content

Instantly share code, notes, and snippets.

Avatar

Normen Hansen normen

View GitHub Profile
@normen
normen / Split Notes To Channels.lua
Last active Mar 2, 2020
Separate Notes to Channels MIDI Machine
View Split Notes To Channels.lua
channels = {} -- save pitch per channel#
channelNo = {} -- save channel# per pitch
function GetFreeChannel()
for i = 1, 16 do if channels[i] == nil then return i end end
Print("Error: ran out of channels")
return 1
end
function OnNote(channel, pitch, velocity)
@normen
normen / homebridge-433-arduino.ino
Created Jun 15, 2017
homebridge-433-arduino code
View homebridge-433-arduino.ino
/*
Arduino code for homebridge-433-arduino
(c) by Normen Hansen, released under MIT license
uses code from http://forum.arduino.cc/index.php?topic=396450.0
*/
#include <RCSwitch.h>
RCSwitch mySwitch = RCSwitch();
const byte numChars = 255; // max number of received chars
char receivedChars[numChars]; // an array to store the received data
@normen
normen / httpserver.js
Last active Jun 14, 2017
JS HTTP server
View httpserver.js
const http = require('http');
const url = require('url');
const fs = require('fs');
const path = require('path');
const port = process.argv[2] || 9000;
http.createServer(function (req, res) {
console.log(`${req.method} ${req.url}`);
// parse URL
const parsedUrl = url.parse(req.url);
// extract URL path