I have two simple scripts, one in Python, one in bash to turn on and off a LED. I don't know what I'm doing wrong but if a run the bash script nothing happen, while the Python script It works flawless.

The strange thing is that if I run the Python script and after that I run the bash script...it works

after the reboot if I run the bash script first doesn't work

Is there something that I need to add in the /boot/config.txt ?

BASH script

gpio mode 18 out
echo LED on
gpio -g write 18 1
sleep 1
echo LED off
gpio -g write 18 0

Python script

import RPi.GPIO as GPIO
import time
print ("LED on")
print ("LED off")

gpio mode 18 out will not do anything, because there is no Wiring Pi pin 18

gpio -g mode 18 out or gpio mode 1 outwill work

| improve this answer | |
  • I confirm it works now – Luca Scalvi Apr 23 '19 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.