Page 65 - MDP2020-2
P. 65

················································································  명장양성프로젝트  【MDP】  과제발표회  자료집  Ⅱ    |  59



                     return  render_template("index2.html")              #index2  호출

             @app.route("/key")                            #손님  비밀번호  화면
             def  lock():
                     return  render_template("index3.html")              #index3  호출

             @app.route("/house/led/on")          #통화  연결
             def  call():
                     try:
                             return  "ok"
                     except  expression  as  identifier:
                             return  "fail"

             @app.route("/house/led/off")        #통화  해제
             def  hangup():
                     try:
                             return  "ok"
                     except  expression  as  identifier:
                             return  "fail"

             @app.route("/house/led/open")      #문  열기
             def  door():
                     try:
                             GPIO.output(INA,  HIGH)                    #모터  정방향  작동
                             GPIO.output(INB,  LOW)
                             return  "ok"
                     except  expression  as  identifier:
                             return  "fail“

             @app.route("/house/led/open/d")  #PIR센서  인식
             def  door_d():
                     try:
                             if(GPIO.input(sensor)==0):            #PIR센서가  인식  되었을  때
                                     return  "ok"
                             else:
                                     return  "no"
                     except  expression  as  identifier:
                             return  "fail"

             @app.route("/house/led/open/c")  #문  닫기
             def  door_c():
                     try:
                             GPIO.output(INA,  LOW)                      #모터  역방향  작동
                             GPIO.output(INB,  HIGH)
                             return  "ok"
                     except  expression  as  identifier:
                             return  "fail“
             @app.route("/key/wrong")                #비밀번호  틀림
             def  compare_wrong():
                     try:
                             return  "ok“

                     except  expression  as  identifier:
                             return  "fail"

             if  __name__  ==  "__main__":
                     app.run(host="0.0.0.0")
   60   61   62   63   64   65   66   67   68   69   70