
from blinkenlights import dimmer, setup, cleanup

pin = 18

setup(pin)

up = range(10)
down = range(9)
down.reverse()

bpm = 70

period = 60.0 / bpm # seconds

time_per_level = period / len(up + down)

for i in range(10):
    for j in (up + down):
        brightness = (j+1) / 10.0
        dimmer(brightness, time_per_level, pin)

cleanup()


from blinkenlights import dimmer, setup, cleanup

pin = 18
bpm = 70

setup(pin)

up = range(10)
down = range(9)
down.reverse()
spectrum = up + down + [-1]

period = 60.0 / bpm # seconds
time_per_level = period / len(spectrum)

for i in range(10):
    for j in (spectrum):
        brightness = (j+1) / 10.0
        dimmer(brightness, time_per_level, pin)

cleanup()

Add a 0.0 duty cycle: brief moment of off time.
Add a 0.0 duty cycle: brief moment of off time.

  
  from blinkenlights import dimmer, setup, cleanup
  
  pin = 18
+ bpm = 70
  
  setup(pin)
  
  up = range(10)
  down = range(9)
  down.reverse()
+ spectrum = up + down + [-1]
- 
- bpm = 70
  
  period = 60.0 / bpm # seconds
- 
- time_per_level = period / len(up + down)
+ time_per_level = period / len(spectrum)
  
  for i in range(10):
-     for j in (up + down):
+     for j in (spectrum):
          brightness = (j+1) / 10.0
          dimmer(brightness, time_per_level, pin)
  
  cleanup()
  
Add a 0.0 duty cycle: brief moment of off time.
## Code Before:

from blinkenlights import dimmer, setup, cleanup

pin = 18

setup(pin)

up = range(10)
down = range(9)
down.reverse()

bpm = 70

period = 60.0 / bpm # seconds

time_per_level = period / len(up + down)

for i in range(10):
    for j in (up + down):
        brightness = (j+1) / 10.0
        dimmer(brightness, time_per_level, pin)

cleanup()

## Instruction:
Add a 0.0 duty cycle: brief moment of off time.
## Code After:

from blinkenlights import dimmer, setup, cleanup

pin = 18
bpm = 70

setup(pin)

up = range(10)
down = range(9)
down.reverse()
spectrum = up + down + [-1]

period = 60.0 / bpm # seconds
time_per_level = period / len(spectrum)

for i in range(10):
    for j in (spectrum):
        brightness = (j+1) / 10.0
        dimmer(brightness, time_per_level, pin)

cleanup()
