Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

looking for alarm example for lucid dreaming minimalistic app (no REM sleep detection)...

ANSWERED

Hello,

I have very small skills in programming (a bit of c# on unity) and i m absolutely newbie Fitbit SDK.

I have a very  simple alarm project for lucid-dreaming purposes (no REM detection needed)

I would like to set an alarm sending very small bumps every X minutes starting at a certain time.

 

ex : at 4 am start sending me 1 very small vibration every 15 mn until i stop the app.

 

i would like the starting time and the snooze amount variable to be set in the settings.

would anyone have an example of an alarm project i could start my cooking with? or explain the process (shall i implement the alarm or set the within Fitbit alarm), where is the API for vibration events and alarm events? or any other advise? 

Thank you very much for answering.

Mathieu.

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

answering my own question...

var alarmHeure = 9;  //this value will come from settings
var alarmMinute =55; //this value will come from settings
var compte = 0;      //this value will come from settings
var interval = 1;    //this value will come from settings

var itsTime = new Boolean(false);


var idVar = setInterval(() => {timer()}, 60000); //granularity in mn

function timer() { //every thing is here
  //
   var dateVar = new Date();
   var time = dateVar.toLocaleTimeString();
   var laMinute = dateVar.getMinutes();            // what time is it : mn
   var lHeure = dateVar.getHours();                  // what time is it : h
  // var millenium = 0;

 
  
  console.log(time);
  console.log(lHeure);
  console.log(laMinute);
 
  
  
   if ((laMinute==alarmMinute)&&(lHeure==alarmHeure))   // if it s time then...
     {
       compte=0;
       vibration.start("bump");
       itsTime=true;                                   //...start counting
       console.log("BINGO!") ;  
       vibration.stop();
     }
  if (itsTime==true)
  {
       compte++;                                       //counting
  }
  
   console.log(compte);
  console.log(itsTime);
  
  if (compte==interval)                               // when time's up restart counting & send a bump
  {
    console.log("Drinng!")
    vibration.start("bump");
    vibration.stop();
    compte=0;
  }
  
 
  
  

View best answer in original post

Best Answer
0 Votes
2 REPLIES 2

answering my own question...

var alarmHeure = 9;  //this value will come from settings
var alarmMinute =55; //this value will come from settings
var compte = 0;      //this value will come from settings
var interval = 1;    //this value will come from settings

var itsTime = new Boolean(false);


var idVar = setInterval(() => {timer()}, 60000); //granularity in mn

function timer() { //every thing is here
  //
   var dateVar = new Date();
   var time = dateVar.toLocaleTimeString();
   var laMinute = dateVar.getMinutes();            // what time is it : mn
   var lHeure = dateVar.getHours();                  // what time is it : h
  // var millenium = 0;

 
  
  console.log(time);
  console.log(lHeure);
  console.log(laMinute);
 
  
  
   if ((laMinute==alarmMinute)&&(lHeure==alarmHeure))   // if it s time then...
     {
       compte=0;
       vibration.start("bump");
       itsTime=true;                                   //...start counting
       console.log("BINGO!") ;  
       vibration.stop();
     }
  if (itsTime==true)
  {
       compte++;                                       //counting
  }
  
   console.log(compte);
  console.log(itsTime);
  
  if (compte==interval)                               // when time's up restart counting & send a bump
  {
    console.log("Drinng!")
    vibration.start("bump");
    vibration.stop();
    compte=0;
  }
  
 
  
  
Best Answer
0 Votes

Hey there, hope you had success with your experiment. If you are interested you can try Lucid Totem. I launched it 2 years ago and been updating and perfecting it ever sicne. It's a watchface app that reminds you throughout the day to do reality checks. 

The app can also wake you during rem if you want to do WBTB techniques.

And there's also a beta REM option like the one you mention, giving you multiple small vibrating alarm throughout the night.
 
I do detect REM using my own algorithm that is pretty accurate, for what the Fitbit can provide
Best Answer
0 Votes