Incorrect output from PyBadge

For Adafruit customers who seek help with microcontrollers

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
pcoxall
 
Posts: 6
Joined: Mon Oct 07, 2019 10:22 pm

Incorrect output from PyBadge

Post by pcoxall »

I bought a class set of 14 PyBadges for this year’s programming class.
So far, everything has been going well.
We started using the buttons today, and I now have an issue.

One (and only 1) is not giving me the correct numbers returned from "ugame.buttons.get_pressed()"
From here (https://circuitpython-stage.readthedocs ... me.buttons) I should be and do for all but 1 device get:
Nothing = 0
B = 1
A = 2
Start = 4
Select = 8
Right = 16
Down = 32
Up = 64
Left = 128

From the one board I am getting:
Nothing = 0
B = 1
A = 6
Start = 6
Select = 8
Right = 48
Down = 48
Up = 192
Left = 192

Here is the code I am using:

Code: Select all

#!/usr/bin/env python3

# Created by: Mr. Coxall
# Created on: October 2019
# This file is the starting point for game using CircuitPython and uGame

import ugame
import stage


def main():
    # repeat forever, game loop

    while True:
        # get user input
        keys = ugame.buttons.get_pressed()
        print(keys)


if __name__ == "__main__":
    main()
Any suggestions?

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Incorrect output from PyBadge

Post by adafruit_support_carter »

There's a general hardware test program you can get from here:
https://learn.adafruit.com/adafruit-pyb ... duino-test
Download that UF2 file, then double press reset to get into bootloader mode, and drag the UF2 file to the PYBADGEBOOT folder.

Once loaded, you can use it to test basic hardware functionality. See if the suspect button still does not respond.

User avatar
MrCoxall
 
Posts: 8
Joined: Thu Oct 03, 2019 11:16 am

Re: Incorrect output from PyBadge

Post by MrCoxall »

Loaded up the test and yes, I am getting the exact same results as I got when I ran my test.
I also loaded the test on a few of my other boards and they are workign fine.

Yes, the error is with just this one board.

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Incorrect output from PyBadge

Post by adafruit_support_carter »

Can you clarify what you mean by getting the same results? Is one button not working? If so - which one? Or are multiple things not working? Etc.

User avatar
pcoxall
 
Posts: 6
Joined: Mon Oct 07, 2019 10:22 pm

Re: Incorrect output from PyBadge

Post by pcoxall »

As I said in my original post, this is the output I am getting from ugame.buttons.get_pressed():

Nothing = 0
B = 1
A = 6
Start = 6
Select = 8
Right = 48
Down = 48
Up = 192
Left = 192

This means when I press the:
- down arrow, it looks like I am pressing the down and right
- right arrow, it looks like I am pressing the down and right
- up arrow, it looks like I am pressing the up and left
- left arrow, it looks like I am pressing the up and left
- A button, it looks like I am pressing the A button and the start button
- Start button, it looks like I am pressing the A button and the start button

Button B and Select are working OK.

Does that help?

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Incorrect output from PyBadge

Post by adafruit_support_carter »

So if you run the hardware test program linked previously:
https://learn.adafruit.com/adafruit-pyb ... duino-test
and press the down arrow, it displays both the down and right icons on the screen? And similarly for the other behaviors?

Please test with that instead of ugame.

User avatar
MrCoxall
 
Posts: 8
Joined: Thu Oct 03, 2019 11:16 am

Re: Incorrect output from PyBadge

Post by MrCoxall »

Yes, that is correct.

User avatar
adafruit_support_carter
 
Posts: 29159
Joined: Tue Nov 29, 2016 2:45 pm

Re: Incorrect output from PyBadge

Post by adafruit_support_carter »

OK, thanks for confirming. Let's just replace it. Send an email to [email protected] with a link to this thread and your order number and they can send you a replacement PyBadge.

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

Return to “Microcontrollers”