Pith - gate_jedi
gate_jedi/pebble_gate_jedi.js [1.2 kb]
Modified: 22:26:49 56 026 (14 May 026)
16 Days Ago
// Gate Jedi Peddle APP (Version 1.3)
// vgmlr
// Pebble Blink APP @Jack-Dangerfield
var Accel = require('ui/accel');
Accel.init();
var UI = require('ui');
var ajax = require('ajax');
var Vector2 = require('vector2');
// Create Window
var main_window = new UI.Window();
// Open Button and Display
var txtOnLabel = new UI.Text({
    position: new Vector2(0, 50),
    size: new Vector2(144, 30),
    font: 'Gothic 28 Bold',
    text: 'GATE JEDI',
    textAlign: 'center',            
    color: 'white'
});
// Display Main Window
main_window.backgroundColor('black');
main_window.add(txtOnLabel);
main_window.show();
// URL To Particle Cloud
function Toggle(function_name,function_value){
  var URL = 'https://api.particle.io/v1/devices/DEVICEID/' + function_name +'?access_token=TOKEN';
  ajax( 
    {
      url: URL,
      method: 'post', 
      type: 'json',
      data: { "args": function_value}
    }
  );
}
// Accelerometer Poll and Function (Default 100Hz 25)
Accel.on('data', function(e) {
  console.log(e.accel.x);
  if (e.accel.x > 900) { 
    console.log(e.accel.y);
      if (e.accel.y > 900) {
  Toggle('gate','open');
 }}
});
// Button Function and Photon Parameters
main_window.on('click', 'up', function() {
  Toggle('gate','open');
});
Updates
Shim - Android 70.026.1
Wedge - Linux 68.026.1
Wedge - Android 68.026.1
Taper - Linux 64.026.1
Ayh Extension - Chrome 63.026.1
Dev
TVShow (227) 'CSA'
TVShow (228) 'APT'
TVProgram (83) 'BXT'
Miter Update(s)
Shim (Dictation)

Menu
Calendar
Project Tin (024/029)
Miter
RSS Feed
User Avatar
@vgmlr
=SUM(parts)