Git Product home page Git Product logo

button-shim's People

Contributors

diddywolf avatar gadgetoid avatar ironbishop avatar pbenja3028 avatar smiura avatar tomnz avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

button-shim's Issues

Please align Button shim LED API with Blinkt! API

As far as I see, the LED on the button shim is the same RGB LED pixel that is used on the Blinkt! pHAT. It would be easier to program with both shims/pHATs if the API would be more uniform, if possible.

The Blinkt! pHAT allows control of the PWM pixel brightness via set_brightness(brightness) with the brightness parameter ranging from 0.0 to 1.0. In contrast, the button shim has the PWN brightness hardcoded as "level" 31 (11111b).

Also, the Blinkt! pHAT has set_pixel(x, r, g, b, brightness=None) which allows the brightness to be controlled independently from the RGB channel values. This actually gives better control, especially in the low brightness region -- the RGB pixel LEDs are very bright, so this better control is desirable.

New Example Code -- Controls Main from Buttons

I have uploaded some example code which illustrates passing a global variable from the button handlers in order to control the main program. I am new to GitHub, so I'm not sure you will be able to get to my repository. Had I had a simple example like this, it would have saved me a lot of time in development. Hope this helps someone.

Run keyboard.py example with IOError: [Errno 2] No such file or directory

Hey,
when I run the keyboard.py example the following error happens:

Traceback (most recent call last):
File "keyboard.py", line 32, in
@buttonshim.on_press([buttonshim.BUTTON_A, buttonshim.BUTTON_B, buttonshim.BUTTON_C, buttonshim.BUTTON_D, buttonshim.BUTTON_E])
File "/usr/lib/python2.7/dist-packages/buttonshim/init.py", line 294, in on_press
setup()
File "/usr/lib/python2.7/dist-packages/buttonshim/init.py", line 186, in setup
_bus = smbus.SMBus(1)
IOError: [Errno 2] No such file or directory

Does anybody have an idea what the failure is?

NUM_BUTTONS is 6, should be 5

...or am I missing a hardware upgrade here? ;) According to the product photos and the library code there are only five hardware buttons A to E present. Can I get a nitpicking label, please?

smbus not found

Hi,

I'm using raspbian stretch lite and after entering the one line installer my simple script won't run, saying smbus is not installed. Here is the error message:

Traceback (most recent call last): File "/home/pi/Scripts/Seismograph/Button-shim-test.py", line 1, in <module> import buttonshim File "/usr/local/lib/python3.6/site-packages/buttonshim/__init__.py", line 1, in <module> import smbus ModuleNotFoundError: No module named 'smbus'

I looked online how to install smbus and I have conflicting answers. I tried

sudo pip3 install smbus

and I get
Could not find a version that satisfies the requirement smbus (from versions: ) No matching distribution found for smbus

Which I don't really understand. Can you help me find a way around this issue?

Thanks!

Volume control throws threading exception

Hi, I've noticed a bug on this line.

"amixer get '{}' | awk '$0~/%/{{print $4}}' | tr -d '[]%'".format(DEVICE),

After trying the original command in terminal I believed the wrong value was used.
"amixer get 'Master' | awk '$0~/%+/ {print $5;exit}' | tr -d '[]%'"

Changing $4 to $5 returned 100 twice. Adding ;exit only returns the first value.

As is setting mute and unmute work fine but changing the volume does not.
Maybe upgrading to the alsaaudio module would be an improvement.
When I did get this working before keeping the button pressed cause the sound to distort.

README Install Steps Not Working after Buster Update

Hello,
After doing a fresh install, using Buster image, and following your README instructions, the ButtonShim produces the following I/O error:

pi@rpiz-inky-phat:~/Pimoroni/button-shim/examples` $ python rainbow.py

Button SHIM: rainbow.py

Light up the LED a different colour of the rainbow with each button pressed.

Press Ctrl+C to exit.


Traceback (most recent call last):
File "rainbow.py", line 16, in <module>
  @buttonshim.on_press(buttonshim.BUTTON_A)
File "/usr/local/lib/python2.7/dist-packages/buttonshim/__init__.py", line 294, in on_press
  setup()
File "/usr/local/lib/python2.7/dist-packages/buttonshim/__init__.py", line 188, in setup
  _bus.write_byte_data(ADDR, REG_CONFIG, 0b00011111)
IOError: [Errno 121] Remote I/O error
pi@rpiz-inky-phat:~/Pimoroni/button-shim/examples $

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.