You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Thanks! Please could you try this?

    var ctr = 0;
    var lasto = {x:0,y:0,z:0};
    
    Bangle.on('accel',o=>{
      g.scroll(0,-1);
      var dy = o.y - lasto.y;
      g.setPixel(120-50, 239, "#808080");
      g.setPixel(120+50, 239, "#808080");
      g.setColor("#ff0000");
      g.fillRect(120+o.x*100, 239, 120+lasto.x*100, 239);
      g.setColor("#00ff00");
      g.fillRect(120+o.y*100, 239, 120+lasto.y*100, 239);
      g.setColor("#0000ff");
      g.fillRect(120+o.z*100, 239, 120+lasto.z*100, 239);
      g.flip();
      ctr++;
      
      g.setPixel(120+dy*100, 239, "#ff00ff");
      
      /*if (o.y>0.45) ctr=0;
      if (o.y<-0.2 && ctr<10) {
        Bangle.buzz();
        ctr=100;
      }*/
      if (dy>0.1) ctr=0;
      if (dy<-0.1 && o.y<-0.1 && 
          Math.abs(o.x)<0.6 && ctr<10) {
        Bangle.buzz();
        ctr=100;
      }  
      lasto=o;
    });
    

    It works on the difference in acceleration (plus a few tweaks to try and stop it going off accidentally).

    Would TensorFlow be an insane over-engineering in this case? :-D

    Yes :) But nothing stops you from doing it - come up with a bunch of training data, train it, dump the file on, and add an aiGesture handler that calls Bangle.setLCDPower(1) :)

    The issue is really the snappiness of it - you want something that turns on quickly or the watch will just seem really slow. Unless you have one of those fancy always-on networks (which we don't do at the moment and which would eat power) you're going to have to wait until Bangle.js thinks the gesture is over before you even start running the Tensorflow model...

About

Avatar for Gordon @Gordon started