Я пытаюсь запустить свой скрипт Python в фоновом режиме при загрузке. Это использовалось для меня все время, когда я хотел запустить свой код, но теперь он, похоже, не работает. Я думаю, что я запускаю NOOBS.
sudo nano /etc/rc.local
#!/bin/sh -e
sudo python /home/pi/Firebase.py &
exit 0
Firebase.py
from firebase import firebase
import RPi.GPIO as GPIO
import time
firebase = firebase.FirebaseApplication('https://raspberrypi-5c0ce.firebaseio.com/', authentication = None)
#result = firebase.put('/light_switch','state', 'off')
#currentState = firebase.get('/light_switch', 'state')
#print(currentState)
#Initialize gpio settings
GPIO.setmode(GPIO.BCM)
GPIO.setwarnings(False)
#Initialize gpio board
input1 = 26
input2 = 19
#setup led color with gpio setup
GPIO.setup(input1, GPIO.OUT)
GPIO.setup(input2, GPIO.OUT)
#GPIO.setup(yellowLed, GPIO.OUT)
#output actual color of led based on variableColor and 1 for tru
while True:
currentState = firebase.get('/light_switch', 'state')
#print(currentState)
if currentState == "on":
GPIO.output(input1, 1)
GPIO.output(input2, 1)
#print("on")
else:
GPIO.output(input1, 0)
GPIO.output(input1, 0)
#print("off")
Firebase.py
(или зачем емуsudo
), так что трудно помочь - person OneCricketeer   schedule 21.03.2017rc.local
? - person OneCricketeer   schedule 21.03.2017