Skip to content

Commit ebb6a07

Browse files
Update all the example comments
1 parent 2d3ab4a commit ebb6a07

File tree

4 files changed

+41
-13
lines changed

4 files changed

+41
-13
lines changed

examples/poll-in-loop/poll-in-loop.ino

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15+
16+
This example creates a single encoder instance that is updated by
17+
running the service method directly in the main program loop. This
18+
must be called frequently enough to avoid missing any pin changes. That
19+
means several hundred times a second in many cases. If a change is detected
20+
in the main loop, the current count is sent to the serial port.
21+
22+
You can add a delay into the loop in this eample to see just how often you
23+
need to call the service method and still get reliable counts.
1524
*/
1625

1726
#include <Arduino.h>

examples/two-encoders/two-encoders.ino

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,21 @@
11
/*
2-
Copyright 2021 Peter Harrison - Helicron
3-
4-
Licensed under the Apache License, Version 2.0 (the "License");
5-
you may not use this file except in compliance with the License.
6-
You may obtain a copy of the License at
7-
8-
https://www.apache.org/licenses/LICENSE-2.0
9-
10-
Unless required by applicable law or agreed to in writing, software
11-
distributed under the License is distributed on an "AS IS" BASIS,
12-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13-
See the License for the specific language governing permissions and
14-
limitations under the License.
2+
Copyright 2021 Peter Harrison - Helicron
3+
4+
Licensed under the Apache License, Version 2.0 (the "License");
5+
you may not use this file except in compliance with the License.
6+
You may obtain a copy of the License at
7+
8+
https://www.apache.org/licenses/LICENSE-2.0
9+
10+
Unless required by applicable law or agreed to in writing, software
11+
distributed under the License is distributed on an "AS IS" BASIS,
12+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
See the License for the specific language governing permissions and
14+
limitations under the License.
15+
16+
This example creates two independent encoders and samples them using a
17+
timer interrupt. If either changes, the current count for both is sent to
18+
the serial port.
1519
*/
1620

1721
#include <Arduino.h>

examples/using-pin-change/using-pin-change.ino

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15+
16+
This example creates a single encoder instance that is updated by
17+
pin-change interrupts associated with the two pins. If a change is detected
18+
in the main loop, the current count is sent to the serial port.
19+
20+
Note that if you enable pin change interrupts for other pins in the same
21+
group, you may cause conflicts.
1522
*/
1623

1724
#include <Arduino.h>

examples/using-timerone/using-timerone.ino

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@
1212
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
15+
16+
17+
This example creates a single encoder instance that is updated by
18+
a timer interrupt running at 1kHz. If a change is detected
19+
in the main loop, the current count is sent to the serial port.
20+
21+
Be sure that the timer interrupt is frequent enough that it cannot miss
22+
a change in pin state.
1523
*/
1624

1725
#include <Arduino.h>

0 commit comments

Comments
 (0)