Any -> Glass

If you are running a WearScript on a device that is paired to Glass, you are able to send gestures to Glass just like the MyGlass app. If you want to setup the socket before you actually send a command, use INIT.


Keyboard -> Glass

By connecting a BT keyboard to Glass you can control the timeline and use the keypresses inside WearScript like you would in a normal webpage. Keyboards like this work well with Glass. First we have to install the Settings.apk so that we can access the pairing options. Install the Settings.apk from here and start the settings using

adb shell am start -a android.intent.action.MAIN -n

You may want to remove the settings apk after you are done as it cause annoying crashes on startup

adb uninstall

Put your device into a bluetooth pairing mode. Select Bluetooth, then use the touchpad to select your device. You’ll be asked to type a code using the keyboard and then you are all done.

Arduino <-> Glass

Bluetooth module:

Arduino code. Make sure to plug the RX from BT into TX of arduino which is pin 2 below.

#include <SoftwareSerial.h>
SoftwareSerial mySerial(3, 2); // RX, TX
void setup() {
  while (!Serial) {

void loop() {
  if (mySerial.available())
  if (Serial.available()) {
      delay(10); // HACK
<html style="width:100%; height:100%; overflow:hidden">
<body style="width:100%; height:100%; overflow:hidden; margin:0">
function main() {
      if (WS.scriptVersion(1)) return;
      WS.serverConnect('{{WSUrl}}', function () {
          WS.bluetoothWrite('20:13:12:05:04:11', 'bluetooth message from glass to arduino');
          WS.bluetoothRead('20:13:12:05:04:11', function (c) {
                WS.log('BT:' + c)
          WS.bluetoothList(function (devices) {
window.onload = main;