send dimmer value to script

Moderator: leecollings

Post Reply
adeibiza
Posts: 27
Joined: Friday 19 October 2018 18:20
Target OS: Raspberry Pi / ODroid
Domoticz version:
Contact:

send dimmer value to script

Post by adeibiza »

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 ?

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) 
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest