-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSweatBox.ino
More file actions
48 lines (36 loc) · 806 Bytes
/
SweatBox.ino
File metadata and controls
48 lines (36 loc) · 806 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
int steps_taken;
int goal;
int[] recent_steps;
void setup() {
steps_taken = 0;
goal = enter_goal();
recent_steps = new int[10];
}
void loop() {
if (step()) {
steps_taken++;
}
int current_activity_level = get_activity_level();
}
boolean step() {
// ask the accelerometer if we're stepping. Debounce ??
return true; //TODO
}
int enter_goal() {
//Enter the target step count.
}
class activity_meter {
/* Keep up with when the most recent 10 steps occured
* so that we can determine how active the user is.
*/
LinkedList queue = new LinkedList(); // queue of most recent steps
void add_step() {
queue.offer(millis());
if (queue.size() > 10) {
queue.pop()
}
}
int activity_level() {
//TODO return a number related to step frequency
}
}