[PEBBLE WATCH] How to write an App for display Data on Pebble Watch

Pebble Watch is a wearable device of new generation very cheap but with enormous advantages for sailors .

This is because at the moment is the only programmable smartwatch have a longer battery and waterproof system (up to 5 atm).

The following guide allows you to write a simple application using the library Javascript simple.js for the use of the data provided by the system OSP .

1 ) First you have to register to the site http://cloudpebble.net

2 ) Create a new project using the Simple.js library

3 ) Insert the following source code :

var UI = require('ui');

var main = new UI.Card({
  title: 'Osp',
  subtitle: 'Fairwind',
  icon: 'images/osp.png',
  body: 'Press select for data'


main.on('click', 'select', function(e) {

  var menu = new UI.Menu();
  menu.item(0, 0, { title: "Boat", subtitle: 'data' });
  menu.item(0, 1, { title: "NULL", subtitle: 'Non disp' });
  menu.item(0, 2, { title: "NULL", subtitle: 'Non disp' });
  menu.item(0, 3, { title: "NULL", subtitle: 'Non disp' });
  menu.item(0, 4, { title: "NULL", subtitle: 'Non disp' });
    var ajax = require('ajax');
  ajax({ url: 'http://<server>:<porta>/fw/data/query/pos', type: 'json' },
  function(data) {
      menu.item(0, 1, { title: data.result[0].pos.lat + data.result[0].pos.latD, subtitle:  "Latitude"});
      menu.item(0, 2, { title: data.result[0].pos.lon + data.result[0].pos.lonD, subtitle:  "Longitude"});
      ajax({ url: 'http://<server>:<porta>/fw/data/query/sog', type: 'json' },
  function(data) {
      menu.item(0, 3, { title: data.result[0].sog + "°", subtitle: "Sog"});
    ajax({ url: 'http://<server>:<porta>/fw/data/query/cog', type: 'json' },
  function(data) {
      menu.item(0, 4, { title: data.result[0].cog.tcog + "°", subtitle: "Cog"});


4 ) Complete the ajax calls with the right IP and port

5 ) Load an image of your choice of size 38x38 of OSP

6 ) Load everything on our Pebble and have fun!

Place ajax calls that you want to read the data of interest!

Ferraro Carmine

Core and Gui Developer - Hardware expert OSP Team