You can use a wrapper script. When the python script crashes, the wrapper script can turn off the LED.
So, the wrapper script would be a simple as:
echo 0 >/sys/class/leds/led0/brightness
Your program is successfully running when started from the command line. So I cannot see a reason why to run it as old style Unix daemon with Type=forking. Then you normally have also to provide the PID of the process so systemd can find the daemon again that it has forked away from its environment. If not needed for backward compatibility of old Unix daemon ...
Kivy can use hardware accelerated libraries on PiOS Lite. Desktop / X is not necessary.
However, for the Pi4 you need to compile the SDL2 libraries from source. The version in the repos was not compiled with the kmsdrm backend, so it only works under X11.
See Kivy documentation
LoRa is NOT intended to be used for such a thing. LoRa operates in the free ISM band. As such there are rules that don't allow transmission over a long period (the maximum allowed transmission time is regulated by the local government) in order to allow other devices to also use the shared medium - thus reducing the air-time. Also LoRa uses transmission ...
What command do you set in your crontab file? Is the script intended to run once and done or constantly post power readings?
As you mention, crons can fail because of path issues. Not only for the script but also for python if that is how you are running the script. For example:
@reboot /usr/bin/python3 /home/pi/example.py
You may wish to save the output of ...
You could start by collecting the output of a nmap run within your program, then parsing its output.
For example, using Python I ran a quick 'ping only' scan of my local network. (Nmap also has an XML output format if you wish to be really thorough!).
command = [
'-sn', # Ping scan only (was '-sP' in older nmap)
This is not really a Pi specific question but programming. Nonetheless checking buttons in callback is error prone.
The traditional approach is to set flags until the callback finishes.
NOTE there should be no reason you can't use gpiozero as this is (normally) just a wrapper around RPi.GPIO.
I note you are still calling SystemExit. This is not normal and ...
The stepper motor is an incremental device. That is to say you can only command it to go in a desired direction for a desired number of steps, where each step is a fixed angular displacement, often 1.8 deg and sometimes 0.9 deg.
So it is easy to go to say a EAST position, where is relative to your last position. To go to a desired absolute angle you need to ...
Found the error.
I define RESOLUTION here and use it correctly
RESOLUTION = (1024, 768)
cam = PiCamera(camera_num=0,
But then in the capture area I use it in the same order, and there it is wrong:
output = np.empty((RESOLUTION, ...
It's been a while since I've used raspistill, but this may work as a cron job:
Create your bash script at /home/pi/camera.sh as follows:
/usr/bin/raspistill -o /home/pi/camera/$DATE.jpg
Be sure to mark it as executable :
chmod a+x /home/pi/camera.sh
Add the following line to your crontab (crontab -e):
* * ...
spidev will use the underlying Pi's Linux SPI driver. The Pi's SPI hardware supports 8 bits only on the main SPI device (spi0.x). The auxiliary SPI device (spi1.x) supports a range of bits (1 to 32). However I don't know if this is supported by the Linux SPI driver.
It seems likely you will have to bit bang the SPI protocol.
As an aside the pigpio SPI ...
I have figured out the cause of this issue, it seems like when the annotator is called several times in the loop it allocates several resources and doesn't release them between loops. The issue was fixed by avoiding to use Annotator and remove it from inside the loop
Make sure that you are building your Flask app in a virtual environment where you have already installed latest psutil module. I am pretty sure you will not get any errors then. Also make sure none of your python scripts are named as psutil.py.
Please make a habit of using virtual environments to avoid these kind of issues if that is the case.
The problem you have is that you're trying to use RPi.GPIO without setting the numbering system as required - as the error message states. However, as mentioned in the comments, it's not recommended that you mix the two libraries, and gpiozero has implicit cleanup, so you don't need to use GPIO.cleanup() - which is mentioned in the docs: https://gpiozero....
It is impossible to determine the pull state of GPIO on most Pi (except by measurement).
It is possible with the BCM2711 used by Pi4 and I have written a Python3 library (based on RPi.GPIO) which does this and a program gpioread which shows this and the actual programmed function/state.
Corrupted git ...
You can't query the pull state with RPi.GPIO.
In fact you can only query the pulls in software in the latest Pi models based on the BCM2711. I'm not sure if any of the mainstream GPIO libraries actually provide support for doing so.
You can install Pip as long as you have Python on the computer.
The Python Packaging Authority (PyPA) maintains the code for PIP on GITHUB here and the latest instructions can be found in the readme associated with the code.
Currently you download the source code:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
then run the code
As an alternative you may try to install ffpyplayer (ex pip3 install ffpyplayer). I also couldn't load any video, had the same Video: Provider: null as you, though for me no issue with the installation of gstreamer and its components.
Now the log tells me:
[INFO ] [VideoFFPy ] Using ffpyplayer 4.3.2
[INFO ] [Video ] Provider: ffpyplayer(['...
PJSIP is definitely what you need. Tell something more about what exactly your problem is.
Example below shows simple application based on PJSUA (high level API of PJSIP).
#define THIS_FILE "sipdtmf.cpp"
using namespace std;
void on_incoming_call(pjsua_acc_id acc_id, pjsua_call_id ...
I hit this error with code which works perfectly with my USB mic on Ubuntu but refused to work on RaspberryPi.
First, since the question was asked, card is outdated and replaced with device.
Second, I had to run alsaaudio.pcms(alsaaudio.PCM_CAPTURE) and use EXACT FULL line of that output as device. In my case it was full line "hw:CARD=SHG7980,DEV=0"...
The mobile phone will be the central (BLE) or client (Classic) so on the RPi you will need to create a peripheral (BLE) or server (Classic).
The two ends of the Bluetooth link need to match, so what you do on the RPi will depend if you already have an app in mind for the phone.
BlueZ is the underlying Bluetooth stack on Raspberry Pi and Python can use it's D-...
Maybe the camera isn't getting enough power and disconnects for a split second... (this would explain why restarting is the only way to fix it... Since if you disconnect and then reconnect the ribbon cable while using the camera, you get the same effect and have to restart the Pi)
Try making sure the camera and pi are getting enough voltage while it's in use....
Unless a device actually communicates on USB, there is no way to know whether it is plugged in or not. The Pi has not built-in equipment to measure the power supply current, or current in a given USB port. And, as you rightfully notice, such measurement wouldn't be a reliable indicator of connection, because once the battery is charged, it stops drawing ...
Have a look at Imagenode, Imagehub, and Imagezmq, I use them in a security camera system that I use on the RPI, you may be able to adapt them to your needs. Imagenode only sends a pic to imagehub when motion is detected. Imagehub does an image classification on pic and tells me if its a dog, cat, car, or person. Then Imagehub sends me a txt alterting me ...
Assuming you mean Python.
Yes, you can run Python on the Pi.
Python 2 and Python 3 are supported.
Copy your code to a file on the Pi. I'll assume your code is called my_code.py.
To run it use either
For Python 2
For Python 3
you need to use the cue path as seen in the cue log. So sync /osc:10.0.0.80:56505/play_this. This should have popped up in the autocomplete after the first message was received by Sonic Pi from your Python script.
If you want your sync to work regardless of where the message came from you can use the * sync /osc*/play_this.
Also, a great place to ask Sonic ...
As you have to with cron if you had put a PATH= in your script it would have found the files. Cron does not inherit any PATH or other environment variables they need to be set or you use absolute paths to the files, as you discovered.
I would recommend using GStreamer for this.
Check out their tutorials to understand how to play a video file, and this page documents how to apply a text overlay.
You will probably want to test using the gst-launch-1.0 command line tool, but to trigger from a GPIO I expect you'll need to write a program. You can use GStreamer from a wide variety of ...