Skip to content

Commit

Permalink
Merge pull request #28 from robgithub/fixgetpixeluse
Browse files Browse the repository at this point in the history
Added brightness parameter as fix to error in test.py and the module test function
  • Loading branch information
Gadgetoid committed Jun 17, 2019
2 parents 612831f + 8994525 commit cee9537
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion python/documentation/Function-reference.md
Expand Up @@ -34,7 +34,7 @@ Note the show() method required to update all pixels after calling set_pixel.

## get_pixel

Gets the RGB colour of a single pixel on a single channel, using the following parameters:
Gets the RGB colour of a single pixel and the brightness(not currently used) on a single channel, using the following parameters:

channel: channel, either 1, 2, 3 or 4, corresponding to numbers on Mote
index: index of the pixel to set, starting at 0 (0-15 for 16 pixels sticks)
Expand Down
11 changes: 10 additions & 1 deletion python/examples/test.py
Expand Up @@ -5,6 +5,12 @@

from mote import Mote

print("""Test
Press Ctrl+C to exit.
""")



mote = Mote()

Expand Down Expand Up @@ -38,7 +44,7 @@
for step in range(170):
for channel in range(4):
for pixel in range(mote.get_pixel_count(channel + 1)):
r, g, b = [int(c * 0.99) for c in mote.get_pixel(channel + 1, pixel)]
r, g, b, z = [int(c * 0.99) for c in mote.get_pixel(channel + 1, pixel)]
mote.set_pixel(channel + 1, pixel, r, g, b)

time.sleep(0.001)
Expand All @@ -56,6 +62,9 @@
time.sleep(0.01)
if brightness < 255: brightness += 1

mote.clear()
mote.show()

except KeyboardInterrupt:
mote.clear()
mote.show()
Expand Down
2 changes: 1 addition & 1 deletion python/library/mote/__init__.py
Expand Up @@ -296,7 +296,7 @@ def __exit__(self):
for step in range(170):
for channel in range(4):
for pixel in range(num_pixels):
r, g, b = [int(c * 0.99) for c in mote.get_pixel(channel + 1, pixel)]
r, g, b, z = [int(c * 0.99) for c in mote.get_pixel(channel + 1, pixel)]
mote.set_pixel(channel + 1, pixel, r, g, b)

time.sleep(0.001)
Expand Down

0 comments on commit cee9537

Please sign in to comment.