Skip to content

Commit

Permalink
show demo of "with" use of re-opening blink1, issues #3, fixed in PR #4
Browse files Browse the repository at this point in the history
  • Loading branch information
todbot committed Apr 19, 2018
1 parent caf6545 commit 33eb4c6
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions blink1_demo/simple_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,22 @@
from blink1.blink1 import blink1

with blink1() as b1:
b1.fade_to_color(100, 'navy')
time.sleep(10)
b1.fade_to_color(300, 'goldenrod')
time.sleep(2)

time.sleep(1)

# notice how blink(1) is turned off and closed
# outside of the 'with' block
# you can override this this 'switch_off' flag

with blink1(switch_off=False) as b1:
b1.fade_to_color(300, 'pink')
time.sleep(2)

with blink1() as b1:
b1.fade_to_color(300, 'aqua')
time.sleep(2)



0 comments on commit 33eb4c6

Please sign in to comment.