Difference between revisions of "Bangle js"

From Sketching with Hardware at LMU Wiki
Jump to navigation Jump to search
Line 26: Line 26:
 
* https://banglejs.com/apps/
 
* https://banglejs.com/apps/
 
* https://gist.github.com/rozek
 
* https://gist.github.com/rozek
 +
 +
=== Visualizing Acceleration data ===
 +
Bangle.loadWidgets();
 +
g.clear(1);
 +
Bangle.drawWidgets();
 +
var R = Bangle.appRect;
 +
 +
var x = 0;
 +
var last;
 +
 +
function getY(v) {
 +
  return (R.y+R.y2 + v*R.h/2)/2;
 +
}
 +
Bangle.on('accel', a => {
 +
  g.reset();
 +
  if (last) {
 +
    g.setColor("#f00").drawLine(x-1,getY(last.x),x,getY(a.x));
 +
    g.setColor("#0f0").drawLine(x-1,getY(last.y),x,getY(a.y));
 +
    g.setColor("#00f").drawLine(x-1,getY(last.z),x,getY(a.z));
 +
  }
 +
  last = a;x++;
 +
  if (x>=g.getWidth()) {
 +
    x = 1;
 +
    g.clearRect(R);
 +
  }
 +
});
  
 
== Bangle.js IDE ==
 
== Bangle.js IDE ==

Revision as of 17:25, 23 March 2022

Bangle1js.JPG

some Features

  • 1.3 inch 240x240 16 bit LCD
  • 2 zone touch
  • Vibration motor
  • GPS receiver (UBlox)
  • Heart rate monitor
  • 3 Axis Accelerometer, 3 Axis Magnetometer
  • 350mAh battery (1 week standby time)
  • Nordic 64MHz nRF52832 ARM Cortex-M4
  • Bluetooth LE
  • 64kB RAM 512kB on-chip flash, 4MB external flash
  • Waterproof (up to 10m)
  • NO Wifi!

Bangle.js 1 & 2

this is an open source smart watch that can be easily programmed in java script.

Examples and Tutorials

Visualizing Acceleration data

Bangle.loadWidgets(); g.clear(1); Bangle.drawWidgets(); var R = Bangle.appRect;

var x = 0; var last;

function getY(v) {

 return (R.y+R.y2 + v*R.h/2)/2;

} Bangle.on('accel', a => {

 g.reset();
 if (last) {
   g.setColor("#f00").drawLine(x-1,getY(last.x),x,getY(a.x));
   g.setColor("#0f0").drawLine(x-1,getY(last.y),x,getY(a.y));
   g.setColor("#00f").drawLine(x-1,getY(last.z),x,getY(a.z));
 }
 last = a;x++;
 if (x>=g.getWidth()) {
   x = 1;
   g.clearRect(R);
 }

});

Bangle.js IDE

There is a online IDE that uses Web-BLE to program the watch. There is no need for any local installation.

Bangle ide.JPG

(Example show is a timer: https://www.espruino.com/Bangle.js+First+App)