Skip to content

Instantly share code, notes, and snippets.

@mezelve
mezelve / WS2812.device.nut
Created March 31, 2014 22:00
the default Electric Imp WS2812 class. SPICLK was lowered from 7500 to 3750 as suggested by @blindman2k
// WS2812 "Neopixel" LED Driver
// Copyright (C) 2014 Electric Imp, inc.
//
// Uses SPI to emulate 1-wire
// http://learn.adafruit.com/adafruit-neopixel-uberguide/advanced-coding
// This class requires the use of SPI257, which must be run at 7.5MHz
// to support neopixel timing.
const SPICLK = 3750;// kHz
@mezelve
mezelve / BlinkM.nut
Created November 19, 2012 14:51
Control a ThingM BlinkM MaxM with an Electric Imp
// BlinkM MaxM controlled by a web form
// http://thingm.com/products/blinkm-maxm.html
server.log("BlinkM Started");
local addr = 0x09;
local rgb = null;
local i2cPort = null;
// Hardware Configuration
//pin 8 -> SCL -> blinkm c
@mezelve
mezelve / mezelve.cpp
Created March 9, 2012 08:19
Arduino Thermal Printing issue with dark bitmaps
// a bitmap 384/384
static unsigned char __attribute__ ((progmem)) mezelve [] = {
0x00,0x15,0x55,0x55,0x54,0x00,0x15,0x40,0x05,0xd5,0x55,0x57,0x15,0x7d,0xf5,0x5f,0xfd,0xfc,0x55,0xd5,0x57,0xf0,0x00,0x00,0x54,0x15,0x45,0x55,0x50,0x55,0x55,0x57,0xd0,0x00,0x01,0xfc,0x00,0x05,0x7d,0x54,0x1f,0xff,0xff,0xff,0xff,0xff,0xf4,0x1f,//
0x00,0x2a,0xaa,0xaa,0xa8,0x00,0x2e,0x80,0x0e,0xff,0xff,0xff,0x8b,0xff,0xff,0xff,0xff,0xfe,0xbf,0xff,0xaf,0xea,0x20,0x00,0xe2,0x0a,0xaa,0xae,0xf0,0xff,0xff,0xff,0xe8,0x00,0x00,0xea,0x00,0x02,0xbf,0xfe,0xbf,0xff,0xff,0xff,0xff,0xff,0xfe,0xbf,//
0x00,0x15,0x55,0x55,0x54,0x00,0x15,0x40,0x05,0xfd,0x55,0x55,0xc5,0x7d,0xf5,0x5f,0xfd,0xfc,0x57,0xf5,0x57,0xc1,0x00,0x01,0x40,0x00,0x00,0x15,0x50,0x55,0x55,0x57,0x40,0x00,0x00,0x00,0x00,0x01,0x17,0xf5,0x7f,0xff,0xff,0xff,0x57,0xff,0xfd,0x5f,//
0x00,0x2a,0xaa,0xaa,0xaa,0x00,0x0a,0x80,0x0e,0xff,0xff,0xff,0x8b,0xff,0xff,0xff,0xff,0xfe,0xbf,0xff,0xaf,0xeb,0xfe,0x8f,0x80,0x00,0x00,0xab,0xe0,0xff,0xaa,0xbe,0x80,0x00,0x00,0x28,0x00,0x02,0xaf,0xff,0xff,0xff,0