Difference between revisions of "Bangle js"
Jump to navigation
Jump to search
(5 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
[[File:Bangle1js.JPG|800px]] | [[File:Bangle1js.JPG|800px]] | ||
+ | |||
+ | == 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 == | == Bangle.js 1 & 2 == | ||
Line 12: | Line 26: | ||
* https://banglejs.com/apps/ | * https://banglejs.com/apps/ | ||
* https://gist.github.com/rozek | * https://gist.github.com/rozek | ||
+ | |||
+ | === Visualizing Acceleration data === | ||
+ | Example from: https://github.com/espruino/BangleApps/blob/master/apps/accelgraph/app.js | ||
+ | |||
+ | <syntaxhighlight lang="javascript" line='line'> | ||
+ | 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); | ||
+ | } | ||
+ | }); | ||
+ | </syntaxhighlight> | ||
== Bangle.js IDE == | == Bangle.js IDE == | ||
There is a online IDE that uses Web-BLE to program the watch. There is no need for any local installation. | There is a online IDE that uses Web-BLE to program the watch. There is no need for any local installation. | ||
− | * https://www.espruino.com/ide/ | + | * IDE https://www.espruino.com/ide/ |
+ | * Emulator https://www.espruino.com/ide/?emulator | ||
[[File:Bangle_ide.JPG|800px]] | [[File:Bangle_ide.JPG|800px]] | ||
(Example show is a timer: https://www.espruino.com/Bangle.js+First+App) | (Example show is a timer: https://www.espruino.com/Bangle.js+First+App) |
Latest revision as of 17:29, 23 March 2022
Contents
some Features[edit]
- 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[edit]
this is an open source smart watch that can be easily programmed in java script.
Examples and Tutorials[edit]
- https://www.espruino.com/Quick+Start+Code
- https://www.espruino.com/Tutorials
- https://banglejs.com/apps/
- https://gist.github.com/rozek
Visualizing Acceleration data[edit]
Example from: https://github.com/espruino/BangleApps/blob/master/apps/accelgraph/app.js
1 Bangle.loadWidgets();
2 g.clear(1);
3 Bangle.drawWidgets();
4 var R = Bangle.appRect;
5
6 var x = 0;
7 var last;
8
9 function getY(v) {
10 return (R.y+R.y2 + v*R.h/2)/2;
11 }
12 Bangle.on('accel', a => {
13 g.reset();
14 if (last) {
15 g.setColor("#f00").drawLine(x-1,getY(last.x),x,getY(a.x));
16 g.setColor("#0f0").drawLine(x-1,getY(last.y),x,getY(a.y));
17 g.setColor("#00f").drawLine(x-1,getY(last.z),x,getY(a.z));
18 }
19 last = a;x++;
20 if (x>=g.getWidth()) {
21 x = 1;
22 g.clearRect(R);
23 }
24 });
Bangle.js IDE[edit]
There is a online IDE that uses Web-BLE to program the watch. There is no need for any local installation.
(Example show is a timer: https://www.espruino.com/Bangle.js+First+App)