def asd(): GPIO.output(led1, GPIO.HIGH) buz.on() while (1): a = GPIO.Input(but1) print a if (a == 1): GPIO.output(led1, FALSE) break GPIO.output(led2, GPIO.HIGH) #digitalWrite(led2,HIGH); while (1): b = GPIO.Input(but2) if (b == 1): GPIO.output(led2, FALSE) break GPIO.output(led3, GPIO.HIGH) #digitalWrite(led3,HIGH); while (1): c = GPIO.Input(but3) if (c == 1): GPIO.output(led3, FALSE) break GPIO.output(led4, GPIO.HIGH) #digitalWrite(led3,HIGH); while (1): d = GPIO.Input(but4) if (d == 1): GPIO.output(led4, FALSE) break buz.off() return 'asd'
def checkStatus(): # klic f() again in pollTime sekunde threading.Timer(pollTime, checkStatus).start() global count1 if (GPIO.Input(17)): # Kopalnica je zaprta updateHTML("Kopalnica1", 1) count1 += pollTime GPIO.output(25, GPIO.LOW) else: # Kopalnica je odprta updateHTML("Kopalnica1", 0) count1 = 0 GPIO.output(25, GPIO.HIGH) if (count1 >= 600): updateHTML("Kopalnica1", 3)
Created on Sun Dec 1 16:46:10 2019 @author: wpqld_000 """ import time import cv2 as cv # opencv import RPi.GPIO as GPIO ledPIN = 20 # led 용 핀 추후 수정 가능 # 모터 핀 바로 위에꺼 servoPIN = 21 # 21번 핀 사용 GND 옆 GPIO.setmode(GPIO.BCM) GPIO.setup(servoPIN, GPIO.OUT) GPIO.setup(ledPIN, GPIO.OUT) # 타이머 대용으로 쓸거므로 out GPIO.Input() p = GPIO.PWM(servoPIN, 50) # GPIO 17 als PWM mit 50Hz l = GPIO.PWM(ledPIN, 50) # 이게 왜 50부터 시작인지는 좀 봐야할거같 """ GPIO.output(ledPIN,GPIO.HIGH) GPIO.output(ledPIN,GPIO.LOW) time.sleep(0.1) """ p.start(2.5) # Initialisierung 초기화 # 정확히는 현재 각도의 값을 몇으로 잡을 것인가를 정의 #우선 생각중인건 무한루프 돌리고,
@app.route('/') def hello(): return render_template('main.html')#Return the main.html template to the web browser using the variables in the templateData dictionary @app.route('/link',methods=["POST"]) def da(): hours=request.form['hours'] #minutes=request.form['mins'] #add to database ##compare return ##reversewatch @app.route('/asd') def asd(): GPIO.output(led1,GPIO.HIGH) buz.on() while(1): a=GPIO.Input(but1) print a if(a==1): GPIO.output(led1,FALSE) break #--------------- GPIO.output(led2,GPIO.HIGH)#digitalWrite(led2,HIGH); while(1): b=GPIO.Input(but2) if(b==1): GPIO.output(led2,FALSE) break GPIO.output(led3,GPIO.HIGH)#digitalWrite(led3,HIGH); while(1): c=GPIO.Input(but3)
import RPi.GPIO as GPIO GPIO.setmode(GPIO.BCM) #make some values pinNum = 17 self.isKilled = False #set the pin GPIO.setup(pinNum, GPIO.IN) #grab the input switch = GPIO.input(pinNum) #check if the kill switch is pressed while True: if self.isKilled == False: if (GPIO.Input(17)): execFile(shutdown.sh) self.isKilled = true else: return