pimoroni / mote

Mote - drivers for the plug and play USB APA102 controller
https://shop.pimoroni.com/products/mote
MIT License
24 stars 14 forks source link

More Examples #8

Closed tommybuck closed 5 years ago

tommybuck commented 8 years ago

More examples by Tom including a cpu utilization traffic light, random blinking of various colours and painting an image.

Gadgetoid commented 7 years ago

Some good stuff in here, but please be careful with filenames- we try to standardize on dash spaced filenames, like-so.py - you've got a mix of dashes, underscores and spaces!

Could you, perhaps, also make the "random blink" examples exist in a single file, which accepts an RGB colour as an argument and acts accordingly? You could use a random float between 0 and 1 (ie the output of random.random()) to scale the R, G and B components of the colour accordingly.

I couldn't get anything sensible out of image-paint.py :( without an accelerator it can't quite work, and will display the image backwards on the back swing. I got a pretty good workout trying, though- interesting idea! 👍

Finally, careful of tabs! The Python convention is to indent using four spaces. I think someone at Adafruit has a bad habit of using tabs 😛

Your contributions are appreciated, so if you find the time please tidy up this PR and we'll see if we can get them merged! (Oh and Welcome to GitHub!)

Gadgetoid commented 6 years ago

Ahoy,

I haven't had a time when a Mote has been within easy reach and I've been working through my PRs! So I've been unable to test and approve these.

I have a couple of changes on my wishlist, though:

Thank you!

tommybuck commented 6 years ago

Changed the logo to Pimoroni's. However I think that example doesn't work anyway so will check it on my mote and remove if necessary.

Will look at the random blinkt examples when I have time.

Gadgetoid commented 6 years ago

Thank you!

The image-paint.py example looks like it should work, although I think it needs a time.sleep() in there somewhere to slow down the swipe.

I would also use a ping-pong method, so the image is displayed line-by-line from left to right on the forward swing. and then again from right to left on the back swing. Then there should be a speed at which sweeping the mote stick back and forth will reveal the image.

I'll have a play with it and see if I can get it working!

Gadgetoid commented 6 years ago

You're right, getting image-paint.py to work is a challenge. Unless you're swinging the Mote Stick at exactly the right frequency and in the right phase it just looks like random flashing. It might work better swung in front of a camera with long exposure.

tommybuck commented 6 years ago

that's how the original device worked. It was mounted on a pvc pipe and walked from left to right of a long exposure camera. Not swung around like on a bike wheel.

On 7 March 2018 at 11:53, Philip Howard notifications@github.com wrote:

You're right, getting image-paint.py to work is a challenge. Unless you're swinging the Mote Stick at exactly the right frequency and in the right phase it just looks like random flashing. It might work better swung in front of a camera with long exposure.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pimoroni/mote/pull/8#issuecomment-371115183, or mute the thread https://github.com/notifications/unsubscribe-auth/AVRJdocn1SLLOW2iMCoYnVnTxJuNye9xks5tb8oygaJpZM4KAuhb .

Gadgetoid commented 5 years ago

Oh boy it's been a while!

If you're still interested in getting these merged- and I understand if you've moved on! - they need a few more tweaks.

First, you should sudo pip install flake8 and run flake8 against your examples and correct any linting issues. From glancing over the code I can see some tab indentation, and minor codestyle issues.

I also think all the random-blink- examples could be merged into random-blink.py, which could take a colour argument to blink the LEDs in your chosen colour. Having multiple, very similar examples with duplicate code can be time consuming to maintain and, well, there's no point exemplifying the same technique more than once.

If you're happy for me to make these changes - I always favour offering the learning opportunity to the person issuign the PR - then let me know and I'll sort it and merge!

Thanks again!

tommybuck commented 5 years ago

Hi,

If you could update the examples please. I just haven't got the time at the moment to play with these.

Cheers,

Tom.

On Tue, 5 Mar 2019, 12:18 Philip Howard, notifications@github.com wrote:

Oh boy it's been a while!

If you're still interested in getting these merged- and I understand if you've moved on! - they need a few more tweaks.

First, you should sudo pip install flake8 and run flake8 against your examples and correct any linting issues. From glancing over the code I can see some tab indentation, and minor codestyle issues.

I also think all the random-blink- examples could be merged into random-blink.py, which could take a colour argument to blink the LEDs in your chosen colour. Having multiple, very similar examples with duplicate code can be time consuming to maintain and, well, there's no point exemplifying the same technique more than once.

If you're happy for me to make these changes - I always favour offering the learning opportunity to the person issuign the PR - then let me know and I'll sort it and merge!

Thanks again!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/pimoroni/mote/pull/8#issuecomment-469659424, or mute the thread https://github.com/notifications/unsubscribe-auth/AVRJdtvB3xxLoQeMhCMPryf6t_QQYBqnks5vTmCigaJpZM4KAuhb .

Gadgetoid commented 5 years ago

Cleaned up and merged in 612831f55ab6e4c3d62f647b0eda014d605c5110

Thank you!