Skip to content

Instantly share code, notes, and snippets.

@bwhite
bwhite / glass.html
Created March 23, 2014 04:46
[wearscript] Media example
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.cameraVideo(function (x) {
setTimeout(function () {
WS.createMedia('file://' + x, false)
}, 5000);
});
@bwhite
bwhite / glass.html
Created March 22, 2014 19:18
[wearscript] My awesome script
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function server() {
@bwhite
bwhite / glass.html
Last active August 29, 2015 13:57
[wearscript] AR Warp with circles
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="offscreen" width="640" height="360" style="display:hidden"></canvas>
<script>
function drawCircle(x, y) {
var width = 640;
var height = 360;
var c = document.getElementById("offscreen");
var ctx = c.getContext("2d");
ctx.fillStyle = 'black'
@bwhite
bwhite / glass.html
Created March 20, 2014 22:48
[wearscript] Read which AR tag is in front of you
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0" bgcolor="#000">
<script>
function main() {
if (WS.scriptVersion(1)) return;
WS.cameraOnBackgroundUnsafe(1, 360, 640);
var model_ar = btoa(msgpack.pack([{'kw': {}, 'name': 'picarus.ARMarkerDetector'}]).map(function (x) {return String.fromCharCode(x)}).join(''));
model = new WS.PicarusModel(model_ar, function () {
model.processStream(function (tags) {
tags = msgpack.unpack(tags);
@bwhite
bwhite / arduino.ino
Last active August 29, 2015 13:57
[wearscript] Arduino Power Tail
#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX
void setup()
{
Serial.begin(57600);
while (!Serial) {
}
mySerial.begin(9600);
@bwhite
bwhite / glass.html
Created March 19, 2014 22:59
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!-- You can include external scripts here like so... -->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
s
@bwhite
bwhite / glass.html
Last active August 29, 2015 13:57
[wearscript] Myo
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script>
function server() {
setTimeout(WS.myoTrain, 250);
return;
WS.gestureCallback('onMyo', function (x) {
WS.say(x);
});
WS.sensorOn('myoOrientation', .15, function (data) {
@bwhite
bwhite / glass.html
Created March 11, 2014 00:55
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<script type="text/html" id="tpl_card0">
<article>
<section>
<ul class="text-x-small">
<li>Gingerbread</li>
<li>Chocolate Chip Cookies</li>
<li>Tiramisu</li>
<li>Donuts</li>
@bwhite
bwhite / glass.html
Created March 8, 2014 00:35
[wearscript]
<html style="width:100%; height:100%; overflow:hidden">
<head>
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/zepto/1.0/zepto.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/underscore.js/1.5.2/underscore-min.js"></script>-->
</head>
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function cb(data) {
// Changes canvas color with head rotation
@bwhite
bwhite / glass.html
Created March 6, 2014 14:01
[wearscript] Neopixel + bluetooth
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
<canvas id="canvas" width="640" height="360" style="display:block"></canvas>
<script>
function NeoPixel(bluetooth) {
this.bluetooth = bluetooth;
this.buffer = ['arduinoneopixel'];
this.concat = function (x) {
this.buffer = this.buffer.concat(x);
}