send dimmer value to script
Posted: Friday 23 August 2019 13:44
I'm using a mosfat relay on raspberry pi pwm pin to control the output voltage to a pump and therefore its speed/pressure -
the python file takes the "speed" value from the cli. i'll need to set up a sh script that then passes the value to the python file but how would i set up a dimmer switch that would pass the value to the bash script in the first place ?
the python file takes the "speed" value from the cli. i'll need to set up a sh script that then passes the value to the python file but how would i set up a dimmer switch that would pass the value to the bash script in the first place ?
Code: Select all
import RPi.GPIO as IO
import time
import sys
arg1 = sys.argv[1]
print (arg1)
arg1 = float(arg1)
IO.setwarnings(False)
IO.setmode (IO.BCM)
IO.setup(18,IO.OUT)
p = IO.PWM(18,100)
p.start(arg1)