Skip to content

Instantly share code, notes, and snippets.

@Neradoc
Neradoc / neopixelTestWithArgs.py
Last active September 18, 2016 13:54
Micropython test for neopixels with arguments using "ampy run".
import time,sys
from machine import Pin
from neopixel import NeoPixel
color = [0,64,64]
if len(sys.argv) >= 4:
try:
col = [int(sys.argv[1]),int(sys.argv[2]),int(sys.argv[3])]
color = col
except:
@Neradoc
Neradoc / CircuitPlaygroundPhoneLight.ino
Last active September 17, 2016 04:45
Phone light with Circuit Playground as a Neopixel ring
#include <Adafruit_CircuitPlayground.h>
#include <Wire.h>
#include <SPI.h>
#define BLINKY 13
// Threshold for a capacitive touch (higher = less sensitive).
#define CAP_THRESHOLD 100
// Number of samples to take for a capacitive touch read.
#define CAP_SAMPLES 40
@Neradoc
Neradoc / log_with_emojis_and_types2.swift
Created April 15, 2016 05:22
A variation on logging with emojis, using an empty enum to namespace static funcs
// a variation of https://gist.github.com/Neradoc/86b3468a1612f8e1d57db20ab2fab5ae
// uses an empty enum as namespace for static functions
// otherwise it's pretty much the same
enum Log {
private static func __log<T>(type:String,_ input:T) {
//#if DEBUG
print(type,input)
//#endif
@Neradoc
Neradoc / log_with_emojis_and_types.swift
Last active April 15, 2016 05:23
Example code for emoji-fueled logs with type safety
// A logging function that uses emojis to make the output prettier
// - one clear way to specify the type of display we want
// - provide type safety for the printed parameter
// - no weird operator syntax ;-)
// Inspired by "Swift: Pretty in print()" by Andyy Hope
// part 1: https://medium.com/p/64832bb7fafa/
// part 2: https://medium.com/p/640cea920653/
// Note: Ideally you would give the object to print first, so the completion