Skip to content

Instantly share code, notes, and snippets.

Avatar

Colten Jackson jazzyjackson

View GitHub Profile
View gist:jq6500play.ino
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <JQ6500_Serial.h>
JQ6500_Serial mp3(2,3);
void setup(){
mp3.begin(9600);
mp3.reset();
mp3.play();
View gist:jq6500playPullUp.ino
#include <Arduino.h>
#include <SoftwareSerial.h>
#include <JQ6500_Serial.h>
JQ6500_Serial mp3(2,3);
void setup(){
mp3.begin(9600);
mp3.reset();
pinMode(A0, INPUT_PULLUP);
View gist:playback.ino
#include <PCM.h>
const unsigned char sample[] PROGMEM = {
128, 127, 128, 128, 128, 128 //...example sound
};
void setup()
{
startPlayback(sample, sizeof(sample));
}
View gist:simplesound.ino
#include <PCM.h>
const unsigned char ghost[] PROGMEM = {
131, 128, 128, 124, 124, 124, //your sound here
};
void setup(){
pinMode(A0, INPUT_PULLUP);
}
View gist:booleanflipflop.ino
#include <PCM.h>
const unsigned char ghost1[] PROGMEM = {
131, 128, 128, 124, 124, 124, 124, 124, 120, 120, 116, 116, 116, 116, 116, 112, 112, 108, 108, 108, 112, 116, 120, 120, 124, 128, 131, 139, 143, 147, 151, 151, 151, 151, 147, 147, 147, 143, 139, 135, 131, 128, 128, 124, 124, 120, 120, 120, 116, 116, 116, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 116, 116, 116, 116, 116, 120, 120, 124, 124, 124, 128, 128, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 131, 128, 128, 128, 124, 124, 124, 120, 120, 120, 116, 116, 116, 112, 112, 112, 112, 112, 112, 112, 112, 108, 112, 112, 116, 120, 124, 128, 131, 135, 139, 147, 151, 155, 155, 155, 155, 151, 151, 147, 143, 139, 135, 131, 128, 124, 120, 120, 116, 116, 116, 116, 116, 116, 116, 116, 116, 120, 116, 116, 116, 120, 120, 120, 120, 120, 120, 120, 120, 120, 120, 124, 124, 124, 124, 128, 128, 131, 131, 131, 131, 135, 135, 135, 135, 135, 135, 131, 131, 131, 131, 131, 128, 128, 128, 124, 124, 124, 120, 120, 116, 116, 112, 112, 112,
View gist:simpleserver.js
var server = require('http').createServer(handler)
var fs = require('fs')
server.listen(80)
function handler(request, response) {
fs.readFile(__dirname + '/index.html',
function (err, data) {
if (err) {
response.writeHead(500)
View gist:index.html
<h1> Hello World! </h1>
<script>
console.log("Hello Console!")
</script>
View gist:betteralertindex.html
<button id="myButton"> Hello World! </button>
<script>
var button = document.getElementById("myButton")
function speak(){ alert("hi!") } // this is a function declaration, allowing 'speak' to be used anywhere in the code, even above this line.
//you can also assign an "anonymous function" to a variable name, but this function can only be called below where it was assigned
//var speak = function() { alert("hi!") }
button.onclick = speak
</script>
View gist:blackwhiteindex.html
<button id="turnBlack">Black</button>
<button id="turnWhite">White</button>
<script>
var turnBlackButton = document.getElementById("turnBlack")
var turnWhiteButton = document.getElementById("turnWhite")
function turnBlack() {
document.body.style.background = 'black'
}
function turnWhite() {
document.body.style.background = 'white'
View gist:OnOffIndex.html
<h1 id="turnBlack">Off</h1>
<h1 id="turnWhite">On</h1>
<script>
var turnBlackButton = document.getElementById("turnBlack")
var turnWhiteButton = document.getElementById("turnWhite")
function turnBlack() {
document.body.style.background = 'black'
turnBlackButton.style.color = 'white'
turnWhiteButton.style.color = 'white'
}