05-16-2020 08:20
05-16-2020 08:20
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.
Answered! Go to the Best Answer.
05-18-2020 06:09
05-18-2020 06:09
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;
}
05-18-2020 06:09
05-18-2020 06:09
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;
}
02-01-2022 13:38
02-01-2022 13:38
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.