Skip to content

Commit 7c02614

Browse files
committed
Add printouts to examples, for terminal usage
1 parent 6d87ab1 commit 7c02614

File tree

9 files changed

+35
-21
lines changed

9 files changed

+35
-21
lines changed

examples/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@
1919
### Buttons
2020
[buttons.py](buttons.py)
2121

22-
A demonstation of reading the 5 buttons on Encoder Wheel.
22+
A demonstration of reading the 5 buttons on Encoder Wheel.
2323

2424

2525
### Encoder
2626
[encoder.py](encoder.py)
2727

28-
A demonstation of reading the rotary dial of the Encoder Wheel breakout.
28+
A demonstration of reading the rotary dial of the Encoder Wheel breakout.
2929

3030

3131
## LED Examples

examples/buttons.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from encoderwheel import CENTRE, DOWN, LEFT, NUM_BUTTONS, NUM_LEDS, RIGHT, UP, EncoderWheel
22

3-
"""
4-
A demonstation of reading the 5 buttons on Encoder Wheel.
5-
"""
3+
print("""
4+
A demonstration of reading the 5 buttons on Encoder Wheel.
5+
6+
Press Ctrl+C to stop the program.
7+
""")
68

79
# Constants
810
BUTTON_NAMES = ["Up", "Down", "Left", "Right", "Centre"]

examples/chase_game.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22

33
from encoderwheel import NUM_LEDS, EncoderWheel
44

5-
"""
5+
print("""
66
A simple alignment game. Use Encoder Wheel's rotary dial to align the coloured band
77
to the white goal. The closer to the goal, the greener your coloured band will be.
88
When you reach the goal, the goal will move to a new random position.
9-
"""
9+
10+
Press Ctrl+C to stop the program.
11+
""")
1012

1113
wheel = EncoderWheel()
1214

examples/clock.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
from encoderwheel import NUM_LEDS, EncoderWheel
55

6-
"""
6+
print("""
77
Displays a 12 hour clock on Encoder Wheel's LED ring, getting time from the system.
8-
"""
8+
9+
Press Ctrl+C to stop the program.
10+
""")
911

1012
# Constants
1113
BRIGHTNESS = 1.0 # The brightness of the LEDs

examples/colour_picker.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
from encoderwheel import CENTRE, DOWN, LEFT, NUM_LEDS, RIGHT, UP, EncoderWheel
55

6-
"""
6+
print("""
77
Create a colour wheel on the Encoder Wheel's LED ring, and use all functions of the wheel to interact with it.
88
99
Rotate the wheel to select a Hue
@@ -12,7 +12,9 @@
1212
Press the left direction to decrease Saturation
1313
Press the right direction to increase Saturation
1414
Press the centre to hide the selection marker
15-
"""
15+
16+
Press Ctrl+C to stop the program.
17+
""")
1618

1719
# Constants
1820
BRIGHTNESS_STEP = 0.02 # How much to increase or decrease the brightness each update

examples/encoder.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
from encoderwheel import EncoderWheel
22

3-
"""
4-
A demonstation of reading the rotary dial of the Encoder Wheel breakout.
5-
"""
3+
print("""
4+
A demonstration of reading the rotary dial of the Encoder Wheel breakout.
5+
6+
Press Ctrl+C to stop the program.
7+
""")
68

79
# Create a new EncoderWheel
810
wheel = EncoderWheel()

examples/gpio_pwm.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
from encoderwheel import CENTRE, GPIOS, NUM_GPIOS, EncoderWheel
77

8-
"""
8+
print("""
99
Output a sine wave PWM sequence on the Encoder Wheel's side GPIO pins.
1010
11-
Press the centre button to stop the program.
12-
"""
11+
Press the centre button or Ctrl+C to stop the program.
12+
""")
1313

1414
SPEED = 5 # The speed that the PWM will cycle at
1515
UPDATES = 50 # How many times to update LEDs and Servos per second

examples/led_rainbow.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33

44
from encoderwheel import EncoderWheel
55

6-
"""
6+
print("""
77
Displays a rotating rainbow pattern on Encoder Wheel's LED ring.
8-
"""
8+
9+
Press Ctrl+C to stop the program.
10+
""")
911

1012
# Constants
1113
SPEED = 5 # The speed that the LEDs will cycle at

examples/stop_watch.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,13 @@
33

44
from encoderwheel import CENTRE, NUM_LEDS, EncoderWheel
55

6-
"""
6+
print("""
77
Display a circular stop-watch on the Encoder Wheel's LED ring.
88
99
Press the centre button to start the stopwatch, then again to pause and resume.
10-
"""
10+
11+
Press Ctrl+C to stop the program.
12+
""")
1113

1214
# Constants
1315
BRIGHTNESS = 1.0 # The brightness of the LEDs when the stopwatch is running

0 commit comments

Comments
 (0)