11-29-2019 07:39
11-29-2019 07:39
Hi all,
I wonder if somebody could help me, I am trying to set an alarm at a certain hour, the problem is that the clock vibrates only if the screen is on. I have tried this:
clock.granularity = "minutes";
const myLabel = document.getElementById("myLabel");
function procedimiento()
{
clock.ontick = (evt) => {
let today = evt.date;
let hours = today.getHours();
hours = util.zeroPad(hours);
let mins = util.zeroPad(today.getMinutes());
myLabel.text = `${hours}:${mins}`;
if(hours == 15 && mins == 28) {
vibration.start("ring");
}
}
}
setTimeout(procedimiento(), 5000);
Is there something I am not considering?
Thanks in advance to all of you.
12-03-2019 04:53
12-03-2019 04:53
If it only vibrates if the screen is on, turn it on just for the vibrate and then turn it off again.
import { display } from "display";
display.on = true;
vibration.start("ring");
display.on = false;
12-03-2019 12:15
12-03-2019 12:15
Thanks for your response, I will try 🙂