Skip to content

Commit

Permalink
Add counting loop from issue #108
Browse files Browse the repository at this point in the history
  • Loading branch information
rm-hull committed Sep 16, 2017
1 parent 204400c commit 15451bc
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions examples/issue_108.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!usr/bin/env python

import time
import argparse

from luma.led_matrix.device import max7219
from luma.core.interface.serial import spi, noop
from luma.core.render import canvas
from luma.core.legacy import text

print('Press Ctrl-C to quit...')

serial = spi(port=0, device=0, gpio=noop())
device = max7219(serial, cascaded=5, block_orientation=0)

currentLoop = 0

if __name__ == "__main__":
parser = argparse.ArgumentParser(description='matrix_demo arguments',
formatter_class=argparse.ArgumentDefaultsHelpFormatter)

parser.add_argument('--cascaded', '-n', type=int, default=5, help='Number of cascaded MAX7219 LED matrices')
parser.add_argument('--block-orientation', type=int, default=0, choices=[0, 90, -90], help='Corrects block orientation when wired vertically')

args = parser.parse_args()

while True:

currentLoop = currentLoop + 1

Tv = str(currentLoop)
Tv = Tv.rjust(5, " ")

with canvas(device) as draw:
text(draw, (0, 0), Tv, fill="white")

print(Tv)
time.sleep(1)

if currentLoop >= 99999:
currentLoop = 0

5 comments on commit 15451bc

@thijstriemstra
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rm-hull is this commit intended?

@rm-hull
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes-ish: it gives us a baseline to test with while investigating #108. I suppose it can be deleted when/if we get to the root cause

@thijstriemstra
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we can move it to a 'scripts' or 'contrib' folder.

@thijstriemstra
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or at least a docstring.

@rm-hull
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, contrib sounds good

Please sign in to comment.