Page 1 of 1
Gamepad --> PC --> PyBoard
Posted: Wed Mar 02, 2016 1:33 pm
by Adixylian
Greetings ya all.
So I am using gamepad with 2 analog "sticks". I am sending that signal via USB to PC, and from PC via usb to PyBoard.
The program works, I'm using bytearray and that struct.pack/unpack. It's perfectly fine.
But some of the buttons cause Keyboard Interrupt. Is it possible to turn the interrupts off?
I know that should be possible as it is an elementary thing in programming microcontrollers.
Thanks for help

Re: Gamepad --> PC --> PyBoard
Posted: Wed Mar 02, 2016 2:13 pm
by Roberthh
Hello, I do not exactly know what you are looking form, but in class usb_vcp, usb_vcp.setinterrupt(-1) would disable Ctrl-C as interrupt character on the USB interface.
Code: Select all
import pyb
usb_vcp = pyb.USB_VCP()
usb_vcp.setinterrupt(-1)
To revert that, call setinterrupt with a value of 3 (= Ctrl-C)
Regards
Re: Gamepad --> PC --> PyBoard
Posted: Wed Mar 02, 2016 2:55 pm
by Adixylian
Yes, exatly that.
Thank you, that helped a lot

Re: Gamepad --> PC --> PyBoard
Posted: Wed Mar 02, 2016 4:44 pm
by kfricke
Re: Gamepad --> PC --> PyBoard
Posted: Wed Nov 16, 2016 11:22 pm
by linuxcircle
How do I connect a generic SNES USB PC gamepad directly into pyboard?
I have the current setup:
USB gamepad -> usb female breakout -> pyboard -> PC via UART (to read values via screen /dev/ttyACM0)
USB Breakout wiring between the pad and pyboard:
USB red wire to V3.3
USB ground wire to to GND
D+ to X10
D- to X9
Is there a way to read the gamepad events via UART and just print the byte codes on the screen? Or is it not supposed to be connected that way?
I was able to read and detect USB on PC: Arch / Raspbian and read button presses using various Python 3 libraries like "input",
but without any OS on the pyboard is it possible to get external peripherals (mouse/gamepad/keyboard) working with MicroPython?