I was writing microcontroller program, due to a tree MeiPa circuit board design, refer to a program of others, but when installing the script errors, SyntaxError: EOL while scanning a string literal
, the problem is in the first row of single quotation marks in the third line and single quotes, help to see if the two single quotes grammatical errors, but the script is already production product use:
Echo 'import RPi. GPIO as GPIO
The import OS
The import sys
The import time
GPIO. Setmode (GPIO. BCM)
PulseStart=0.0
SHUTDOWN=# 24 pin 18
BOOT_OK=23 # 16 pin
REBOOTPULSEMINIMUM=0.2 # reboot pulse signal should be at further this long
REBOOTPULSEMAXIMUM=0.6 # reboot pulse signal should be most at this long
Print (" \ n=====================================\ n ")
Print ("==ATX - PSU_startup: Initializing GPIO ")
GPIO. Setup (SHUTDOWN, GPIO. IN pull_up_down=GPIO. PUD_DOWN)
GPIO. Setup (BOOT_OK, GPIO. OUT, initial=GPIO. HIGH)
Try:
While True:
Print (" \ n==Waiting for shutdown pulse \ n ")
GPIO. Wait_for_edge (SHUTDOWN, GPIO. RISING)
Print (" \ nshutdown pulse received \ n ")
PulseValue=https://bbs.csdn.net/topics/GPIO.input (SHUTDOWN)
PulseStart=time. Time ()
PinResult=GPIO. Wait_for_edge (SHUTDOWN, GPIO. FALLING, timeout=600)
If pinResult==None:
GPIO. The output (BOOT_OK, GPIO. LOW)
OS. The system (" sudo poweroff ")
Sys. The exit ()
Elif time. Time () - pulseStart & gt;=REBOOTPULSEMINIMUM:
GPIO. The output (BOOT_OK, GPIO. LOW)
OS. The system (" sudo reboot ")
Sys. The exit ()
If GPIO. Input (SHUTDOWN) :
GPIO. Wait_for_edge (SHUTDOWN, GPIO. FALLING)
Except:
Pass
Finally:
GPIO. The output (BOOT_OK, GPIO. LOW)
GPIO. The cleanup ()
'& gt; The/etc/ATX - PSU_startup. Py
Sudo chmod 755/etc/ATX - PSU_startup. Py
Sudo sed -i '$I python/etc/ATX - PSU_startup. Py & amp; '/etc/rc. Local