projects
/
the_perfect_clock.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
6e022cd
)
Changed the hysteresis algorithm to make 'on' be 20 out of 100 samples
author
Art Cancro
<ajc@citadel.org>
Thu, 12 Oct 2023 03:03:08 +0000
(23:03 -0400)
committer
Art Cancro
<ajc@citadel.org>
Thu, 12 Oct 2023 03:03:08 +0000
(23:03 -0400)
the_perfect_clock.ino
patch
|
blob
|
history
diff --git
a/the_perfect_clock.ino
b/the_perfect_clock.ino
index 590a1c7fa51ed51306605a47d52fadeda59ef130..d437e392bfbd2ec2182770119718611d84251a2f 100644
(file)
--- a/
the_perfect_clock.ino
+++ b/
the_perfect_clock.ino
@@
-91,8
+91,9
@@
void loop() {
static int total_samples = 0;
static int high_samples = 0;
static int total_samples = 0;
static int high_samples = 0;
- if (total_samples >= 1000) {
- if (high_samples > 500) {
+ // read from the WWVB receiver, with some hysteresis
+ if (total_samples >= 100) {
+ if (high_samples > 20) {
signal = HIGH;
}
else {
signal = HIGH;
}
else {
@@
-108,6
+109,7
@@
void loop() {
}
}
}
}
+ // has the timer ticked?
unsigned long m = millis();
if (m != previous_millis) {
millisecond += (m - previous_millis);
unsigned long m = millis();
if (m != previous_millis) {
millisecond += (m - previous_millis);
@@
-126,10
+128,9
@@
void loop() {
previous_millis = m;
int pulse_length;
previous_millis = m;
int pulse_length;
- //int signal = digitalRead(wwvb); // is the input high or low right now?
if (signal) {
if (signal) {
- analogWrite(timecodeled,
10
); // it's too bright on my board so we dim it; change to digitalWrite() if not needed
+ analogWrite(timecodeled,
5
); // it's too bright on my board so we dim it; change to digitalWrite() if not needed
}
else {
digitalWrite(timecodeled, LOW);
}
else {
digitalWrite(timecodeled, LOW);