Unable to import gamepad in CircuitPython 2.1.0 on Trinket M

CircuitPython on hardware including Adafruit's boards, and CircuitPython libraries using Blinka on host computers.

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
jasojohns
 
Posts: 8
Joined: Tue Jun 24, 2014 11:40 am

Unable to import gamepad in CircuitPython 2.1.0 on Trinket M

Post by jasojohns »

Hi, per the advice from kattni I've created a new topic...previously posted in the "CircuitPython 2.1.0 released!" thread.

I've attempted to update circuitpython (using the UF2 flashing method) on my Trinket M0 in the hopes of using gamepad. I think the update was successful as my REPL console shows that it is using 2.1.0, but upon importing gamepad I get an import error.

Code: Select all

Adafruit CircuitPython 2.1.0 on 2017-10-17; Adafruit Trinket M0 with samd21e18
>>> import gamepad
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'gamepad'
Simply importing gamepad in my main.py yields similar results, get a flashing error code indicating that gamepad module can't be found.

I bought 4 Trinket M0s and checking REPL on one of the others shows that it has 2.0.0 on it, so seems that my update to the first one was successful.

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: Unable to import gamepad in CircuitPython 2.1.0 on Trink

Post by tannewt »

Hi Jasojohns,
gamepad isn't available on non-Express boards in order to save space. What are you trying to use it for?

Reading buttons can be done with digitalio.DigitalInOut on the Trinket and Gemma.
~Scott

User avatar
jasojohns
 
Posts: 8
Joined: Tue Jun 24, 2014 11:40 am

Re: Unable to import gamepad in CircuitPython 2.1.0 on Trink

Post by jasojohns »

Ah, well that would explain it!

I just need to detect when a button is pressed and released, seemed gamepad was easy to use but did not realize it wasn't going to be available on the M0. I will look into doing it the old fashioned way. thanks!

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: Unable to import gamepad in CircuitPython 2.1.0 on Trink

Post by tannewt »

Cool! Yup, gamepad is for more advanced use when you definitely don't want to miss a press. (For example, when you are rendering a video game and listening for button presses.)

User avatar
jasojohns
 
Posts: 8
Joined: Tue Jun 24, 2014 11:40 am

Re: Unable to import gamepad in CircuitPython 2.1.0 on Trink

Post by jasojohns »

Well, that would be nice as I don't want to miss a press (or release). Aside from updating an LCD screen and changing colors on a neopixel, I'm hoping to get some 2 way serial communication working with a Feather (there will be 4 or 5 Trinkets in communication with the Feather), each trinket letting the Feather know if it's button has been pressed or not, and the Feather sending text and state updates down to each Trinket. I'm hoping that checking for button state changes during all that won't get lost...

User avatar
tannewt
 
Posts: 3315
Joined: Thu Oct 06, 2016 8:48 pm

Re: Unable to import gamepad in CircuitPython 2.1.0 on Trink

Post by tannewt »

jasojohns, its usually not an issue. Just know its there. :-)

Locked
Please be positive and constructive with your questions and comments.

Return to “Adafruit CircuitPython”