Running the script at startup FAILED

Options
bruce
bruce New Member Posts: 15
I have a script which includes the operations of GPIOs, Sensors, USB flash drive.
The script runs perfectly when I execute it using the terminal. Now I want to launch the script at start up because I want to use the system as a portable device.

so, I wrote a test script to check whether it is working or not (on startup).
import RPi.GPIO as GPIO
import time

GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)

GPIO.setup(3,GPIO.OUT)	
GPIO.setup(4,GPIO.OUT)	
GPIO.setup(27,GPIO.OUT)	
GPIO.setup(17,GPIO.IN)	

while True:
	input_value = GPIO.input(17)	
	GPIO.output(27,GPIO.HIGH)
	
	if input_value == False:
		GPIO.output(27,GPIO.LOW)
		GPIO.output(3,GPIO.HIGH)
		time.sleep(5)
		GPIO.output(3,GPIO.LOW)
		GPIO.output(4,GPIO.HIGH)
		time.sleep(5)		
		GPIO.output(4,GPIO.LOW)
		while input_value == False:
			input_value = GPIO.input(17)

I specify the path in
/etc/rc.local
to launch this simple code at start up
sudo python /home/myUPboard/myProject/test.py
exit 0

So, next time I changed the path to the script which includes the operations of sensors/USB/gpios

But it is not working anymore, the same code runs using the terminal but not while start up. Please helep
Privacy Policy