I serched and tried different ways to start a python script which starts the camera on a raspberry PI3.
first attempt : through crontab
sudo crontab -e
added :@reboot python3 /home/pi/camera.py
- script :
from picamera import PiCamera from time import sleep camera = PiCamera() camera.framerate = 15 camera.start_preview()
second attempt through crontab :
sudo crontab -e
added :@reboot /home/pi/launcher.sh >/home/pi/log/cameralog.log 2>&1
- script camera.py stays thesame
- launcher.sh :
#!/bin/bash clear cd / cd home/pi /usr/bin/python3 /home/pi/camera.py cd /
third attempt :
removed all from crontab and used rc.local
sudo nano /etc/rc.local
added : /usr/bin/python3 /home/pi/camera.py&
Non of the above ways is starting the script at reboot.
I'm new to raspberry and python. what's wrong?
Type-
at the end of the file add the following line