-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspray_pulse.py
executable file
·30 lines (24 loc) · 1.06 KB
/
spray_pulse.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import RPi.GPIO as GPIO
import time, threading
import argparse
import sys, select
import BIUpinlist as pin
#gpio output pin
pulseLen = 0.016 # s, length of DC pulse to sprayer
pulseSep= 0.005 # s, length of seperation between pulses
numPulse = 5 # number of pulses
if __name__=='__main__':
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(pin.cannon,GPIO.OUT)
parser = argparse.ArgumentParser(description='Arguments for sample pulse')
parser.add_argument('--ptime', help='Duration of application pulse (seconds)', default = pulseLen, type=float,required=False)
parser.add_argument('--pcycles', help='number of application pulses',default = numPulse, type=int,required=False)
parser.add_argument('--breaktime', help='Pause between application pulses (seconds)',default = pulseSep, type=int,required=False)
pulseArgs = parser.parse_args()
for x in range(pulseArgs.cycles):
GPIO.output(pin.cannon,GPIO.HIGH)
time.sleep(pulseArgs.stime)
GPIO.output(pin.cannon,GPIO.LOW)
time.sleep(0.2)
GPIO.cleanup()