I want to use Python to access OneWire devices directly on my Pi 4b without using the device-file method (open a device file, read its contents, close the file ... for each device on the bus). Installing the right library/package/whatever on my Pi seems to be a bit more Linux than I have experience for. Is there a simple set of instructions somewhere for this?
Related
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.
I am trying to write a Python script to identify USB devices that did not get auto-mounted correctly in Linux. I am currently using subprocess and calling lsusb to gather the USB devices and then using PyUsb (A libusb 1.0 python wrap library) to find the category of the USB device so I can identify if it is a Mass Storage Media. What I can't figure out is how to bridge the information I have into the mountpoint that belongs to that USB drive. I need a combination of Linux commands that will get me the information I can use to link a mountpoint to a specific USB device so I can use subprocess and some basic parsing to create the script. Or maybe some other way to do this with Python modules I haven't thought of using.
I found a way to do it using information from mount and fdisk. I wrote a python module that encapsulates everything if anyone has the need for something similar: https://github.com/arthurbayerlein/Python/blob/master/storage_media.py
i have a Arduino which is connected to my PC. I'm sending some hex values over Serial port (with Python/Spyder IDE) to it to control the GPIO pins.
Is there a way to upload the sketch to the Arduino without using the IDE.
I don't want to write the sketch in python. Just want to upload a existing sketch via a Python script.
Thanks for your help!
You can build and upload Arduino sketches with python, there are two worthwhile tools: build_arduino.py and arduino-sketch.
Their pages provide detailed installation and usage instructions.
I am using a Raspberry Pi zero that runs on Rasbpian, and am connecting it with a computer, through a transceiver. I use minicom on the Raspberry Pi and Putty on the laptop to second documents.
I wrote some code that automatically generates files in a folder, and want to send those files through serial to my laptop the moment they are generated. I've heard that I can use rsync for this, but only read about people using it with SSH. One friend advised using piping, but I am new to this, so did not understand how to use piping with rsync.
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).