Skip to content

Instantly share code, notes, and snippets.


Matthew Hungerford mhungerford

  • ChargePoint
  • Silicon Valley
View GitHub Profile
mhungerford / application.cpp
Created Apr 19, 2015
SparkFM Pebble (spark core code)
View application.cpp
// A fun program for the Spark Core that works without the use of the tone() function
// Originally written by Brett Hagman (,
// Reworked by Technobly ( for the Spark Core.
// This plays RTTTL (RingTone Text Transfer Language) songs
// by bit-banging a selected digital output.
// To play the output on a small speaker (i.e. 8 Ohms or higher), simply use
// a 220 ohm to 1k ohm resistor from the output pin (D6) to the speaker,
// and connect the other side of the speaker to ground.
mhungerford / app.js
Last active Feb 8, 2021
SparkFM for Pebble
View app.js
var UI = require('ui');
//Replaced # with _, to support urlEncoding for POST
//Max RTTTL length is 512 (buffer on spark hard-coded).
var song_list = [
{song: "Back to the Future",
rtttl: "d=4,o=5,b=100:c_4,g_.4,8c_,b.4,16a_4,16g_4,8a_.4,8g_.4,8f_4,g_.4,16g_4,16g_4,2g_.4,c_,g_.,8c_6,b.,16a_,16g_,8a_.,8g_.,8f_,1g_,g_.,c_.,2g.,32g_.,32a_.,8g_,8f,8c_,g,32g_.,32a_.,8g_.,8d_.,8g_.,8d_.6,d_.6,d6,32c.6,32d.6,2d_.6,16d_,16g_,16d_,16g_,16c_6,16a_,16d_6,16g_6,c_.6,f_.,2c.6,32c_.6,32d_.6,8c_6,8a_,8f_,c6,32c_.6,32d_.6,8c_.6,8g_.,8c_.6,8g_.6,g_.6,g6,32f.6,32g.6,2g_.6"},
{song: "Barbie Girl",
rtttl: "d=4,o=5,b=125:8g_,8e,8g_,8c_6,a,p,8f_,8d_,8f_,8b,g_,8f_,8e,p,8e,8c_,f_,c_,p,8f_,8e,g_,f_,8g_,8e,8g_,8c_6,a,p,8f_,8d_,8f_,8b,g_,8f_,8e,p,8e,8c_,f_,c_,p,8f_,8e,g_,f_,8g_,8e,8g_,8c_6,a,p,8f_,8d_,8f_,8b,g_,8f_,8e,p,8e,8c_,f_,c_,p,8f_,8e,g_,f_"},
{song: "Butterfly",