![]() ![]() Use Fitbit silent alarms to support all your health goals by setting one as a reminder to…Įat! Especially if you plan on heading straight to the gym from work. The most obvious use for a silent alarm is, literally, as an alarm clock-stay on that sleep schedule !-but limiting yourself to one alarm is a missed opportunity. At the time(s) you specified, your device will gently vibrate and light up several times, repeating again in nine minutes if you don’t dismiss it. First, does the alarm time (12:01:00 PM) match the snooze time (12:01:05 PM)? Nope, so the alarm never shuts off (your current logic makes it so it will never match).You backup your computer, so why not your brain? That’s the idea behind silent alarms-aka safety nets for your memory-and why all Fitbit trackers (except Fitbit Zip-sorry!) allow you to set up to eight.ĭepending on which tracker you own, your setup screen may look a bit different than the ones below-you may even be able to manage your silent straight from your device (check out this helpful how-to guide)-but all the silent alarms work the same. How about the second if block (the one you are expecting to hit). The first if block won't get hit (the alarm time of 12:01:00 PM doesn't match the current time 12:01:05 PM). So your data looks like this: You have 1 alarm set to go off at 12:01:00 PM and current state is snooze. Let's jump ahead a few iterations of the loop to where the time is 12:01:05 PM (none of the if blocks will have been hit in the mean time). Nope, doesn't match, so we skip the if block. First, we check to see if the alarm's time (12:01:00 PM) matches the snooze time (12:01:05 PM). So after that if block, your data is this: You have 1 alarm set to go off at 12:01:00 PM and current state is snooze. The snooze time is set for 5 seconds into the future and the alarm state is set to snooze. The first if block is hit (the alarm time matches the current time (note that the state of the alarm isn't checked here, possibly a bug?). Your data looks like this: You have 1 alarm set to go off at 12:01:00 PM and current state is on. The alarm doesn't match the current time so neither of the if blocks are used. Let's walk through the code with a some sample data: You have 1 alarm set to go off at 12:01:00 PM and current state is on. The problem appears to me that you are setting a variable to determine when a snoozed alarm should go off, but then never update the alarm to go off at that time. Hour = when.Hour & Minute = when.Minute & Second = when.Second return (State = AlarmState.On || State = AlarmState.Snooze) & ![]() Return (State != AlarmState.Off & Hour = when.Hour & Minute = when.Minute & Second = when.Second) This is the matches method that I'm using: // Returns whether alarm should go off at time "when". Thread.Sleep(1000) // pause for a secondĬurrTime = DateTime.Now // update current time If (alarm.Matches(snoozeTime) & alarm.State = AlarmState.Snooze) Continually show current time until alarm time reached.Ĭonsole.WriteLine("Current time is: ", snoozeTime) This is the relevant part of the main program: // Get current time. However, the alarm never seems to match the snoozeTime, even though when I print snoozeTime it looks like it matches.Īlso, if you're curious why I'm setting snooze for just 5 seconds in the future, it's because I can't figure out how to use keypresses yet. Right now, the state changes and the snoozeTime variable is set properly. It loops through the array and if one alarm matches the current time and the AlarmState is "On" the alarm goes off, sets a DateTime variable of "snoozeTime" to 5 seconds in the future, and changes the state to "Snooze." However, if it loops through the array and one alarm matches the snoozeTime as well as the state is "Snooze" then it changes the alarm state to "Off." The way it works right now is that a couple of alarms are loaded when the program starts.Įach alarm is an object of an Alarm class added to an array with the enum AlarmState set to "On". I have to modify an alarm program for class and I can't see why it's not working. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |