I need to create an arcade cabinet with a clone of an old arcade videogame. A Raspberry PI3 must be used for the:
Running the videogame
External LEDs Control via GPIO
A USB joystick must be used for the control of the main character. I must read the buttons and axis of the joystick from the game. The game is written on java and uses library processing-core.jar (library of the programming language processing). But I cannot find any library to read the button states from Java that runs on Raspberry Pi OS.
I used GameControlPlus - library for processing, but it doesn't work on this processor architecture with this operating system: It can not find right native methods. I tried to emulate my keyboard and mouse via a USB controller. But I need to launch this software and select the configuration file by every launch of the raspberry pi. I founded, that the controller info lays in the dev/controls and the USB controller signals can be read from this directory using evdev, but it uses Python. But I use Java and don't know any another programming languages.
Related
I’m building an underwater ROV. My intent is to tether the ROV from a PC via an Ethernet cable. On board the ROV is a RPI.
Currently, I have established a motor control program on the RPI, using a PS4 controller for input commands. I’m using the pygame module to capture the analog and button inputs from the PS4 controller.
Moving the PS4 controller to the PC with a USB connection, I can read the PS4 commands, again by way of the pygame module running on the PC.
With a Remote Desktop Connection between the PC the RPI, I can run the motor control program on the RPI, but my problem is that I have yet to find a way to pass the PS4 commands from the PC to the motor control program running on the RPI.
Other than what I have described above, I am stumped as to where to go from here. I suspect the solution has to do with passing parameters from a program on the PC over Ethernet to the RPI, an area to which I am clueless.
There are some libraries such as CircuitPython that allow programmers to interact with Arduinos but can one control PC hardware such as the keyboard, usb ports, mouse etc using python?
I have explored various websites but they all focus on controlling Arduinos and Pyboards. I have also tried using the Linux Kernel API (kernel_ffi) but it seems impossible to make a cross-platform script with it.
Basically my project involves displaying a certain animation on a LG TV. The only input I've been given is an USB interface.
From there on the goal is to display an animation or e.g. the current time, date, a countdown or anything alike which could be created with Python libraries.
-> So I need to somehow get a live animation / screensaver running via an USB-Stick on a LG TV. I searched for any Python packages that would enable me to do something like this, but unfortunately I wasn't able to find anything.
Does anyone have ANY idea on how to approach something like this? Feel free to ask any questions if the task isn't understandable.
The easiest method would be to render the animation into a video container that the Smart TV understands. Like mkv or mp4
Python is an interpreted language and it seems wasteful to try get a way for the Smart TV to interpret the Python code.
Unless the animation has interaction - record it on a PC, save to USB and play on TV.
You could also use a Raspberry Pi or Pi Zero with a linux distribution running Python. Then just use the TV as an HDMI monitor.
Do you know the scripts you would like to run?
Install Linux Raspbian (or other) on Raspberry Pi/Pi zero ($35/$11 ea.) at this time enabling or connecting it to WiFi - it sounds like you want values and items from the internet.
Install Python 3 on the Pi: https://installvirtual.com/how-to-install-python-3-8-on-raspberry-pi-raspbian/
Install the dependencies and libraries like: pip install pandas (or whatever libraries you need like matplotlib)
Run your Python script on the Raspberry Pi.
If you want to have the script execute on Startup (I assume you want this installation to be relatively hands-off) - https://www.instructables.com/id/Raspberry-Pi-Launch-Python-script-on-startup/
I would recommend adding a timeout on opening the script, with option to return to the OS and exit the script or you won't have much access to maintain the Pi (it will start executing the script immediately.)
Make sure you know how to do PuTTy access over SSH (or VNC) to maintain the Pi - as you don't want to try debug and code directly on the Pi - especially if this is a public display.
Short version: How do I monitor a USB port's input?
Long version: I wanted to use a console controller for my pc games, but couldn't find a freeware method of doing so that I liked. So I decided to make one myself, as much as a learning exercise as anything else, but I'm not sure how to monitor input on a USB port. I assume that if I can monitor one, it won't be hard to experimentally determine what each input is (A button = 00011 etc) on the keyboard, mouse and controller and then just convince the computer that the controller is a keyboard/mouse by switching whatever is inputted by it to what would have been inputted by one of the other devices.
I tried Google, but no luck. Same with this site. I know some C, C++ and Python but I wouldn't call myself a power user of any of them, part of the reason I'm doing this really. Currently using Windows Vista and Windows 10. Any help getting started would be appreciated.
Try pyusb and you will find examples on how to communicate with USB devices. It seems that the current repository is at GitHub: https://github.com/walac/pyusb
I am new to Raspberry Pi. I need to read and write to the GPIO pins on the Raspberry Pi. I am trying to do this operation in php, python, and the command line. Do I need to download any kind of library to do this in php, python, or command line?
No, controlling GPIOs from userspace is a feature provided by the operating system. You just need to write a number to the GPIO value "file" thats provided by the kernel. It is located under /sys/class/gpio/gpio<number>/value. This should give you a kickstart. There they show how its done on the BeagleBoard with the shell but it is a general concept and it doesnt matter which language you use.
In python you can use the GPIO library
Generally in unix devices are represented as files, so you can open a file in /dev/ and read/write to the devices.
You might get more detailed help on https://raspberrypi.stackexchange.com/
Besides sysfs, the virtual filesystem that allows root to directly read from and write to GPIO pins by echo to or cat from various files in the /sys/class/gpio/ folder (as already mentioned) there are libraries available to do so. Two noteworthy examples are:
wiringPi library provides a cli command gpio to be used by non-privileged users for direct access.
pigs utility, part of the pigpio library also offers comprehensive control of the GPIO pins from the command line (see pigpio for download of source, installation procedures and excellent application examples).