Closed alphaville closed 1 year ago
I followed this guide and ran this command sudo crontab -e
and added this line
@reboot python3 /home/bzzz/Desktop/bzzz/raspberry/read_sbus/read_sbus_from_GPIO_receiver.py
at the end of the file.
@gunturiCM just be careful with sudo
. You may or may not need to use it. Does it work now?
Had some issues. But everything is fixed now. The Python script in a virtual environment starts after powering up as expected.
The modifications were:
In crontab, the above line was changed to
@reboot sleep 10 && /home/bzzz/Desktop/run_sbus_rx.sh
and the shell script from the previous setup was modified and added to the desktop. The contents of the bash script are.
#!/bin/bash
pushd /home/bzzz/Desktop/
source bin/activate
python3 /home/bzzz/Desktop/bzzz/raspberry/read_sbus/read_sbus_from_GPIO_receiver.py
popd
Then python virtual environment support was installed
sudo apt-get install python3-venv
Then create and activate the venv
.
sudo python3 -m venv /home/bzzz/Desktop/
source bin/activate
Change permissions to allow pip
to be able to install modules in venv
sudo chmod -R a+rwx ~/Desktop/
Install the required modules inside the venv
python3 -m pip install bitarray
python3 -m pip install pigpio
python3 -m pip install pyserial
@gunturiCM just be careful with
sudo
. You may or may not need to use it. Does it work now?
Yes, professor, it works now.
Run the Python script on startup using
crontab
. Make sure you run it from within a virtual environment. Check the old Raspberry Pi (runcrontab -e
).