コード例 #1
0
ファイル: security.py プロジェクト: TarekElsherif/iot_test
 def _callback(m, channel):
     if m['led'] == 1:
         if led == 0:
             led_on()
             print 'LED ON'
     if m['led'] == 0:
         if led == 1:
             led_off()
             print 'LED OFF'
     if m['lock'] == 1:
         if lock == 0:
             lock = 1
             doorservo.lock()
             print 'DOOR LOCKED'
     if m['lock'] == 0:
         if lock == 1:    
             lock = 0
             doorservo.unlock()
             print 'DOOR UNLOCKED'  
コード例 #2
0
 def _callback(m, channel):
     if m['led'] == 1:
         if led == 0:
             led_on()
             print 'LED ON'
     if m['led'] == 0:
         if led == 1:
             led_off()
             print 'LED OFF'
     if m['lock'] == 1:
         if lock == 0
             lock = 1
             doorservo.lock()
             print 'DOOR LOCKED'
     if m['lock'] == 0:
         if lock == 1:    
             lock = 0
             doorservo.unlock()
             print 'DOOR UNLOCKED'    
コード例 #3
0
ファイル: security.py プロジェクト: TarekElsherif/iot_test
            'led': led,
            'lock': lock,
            'ir': ir,
            'occ': occ
        }

def update_data():
    global data
    data = {
            'led': led,
            'lock': lock,
            'ir': ir,
            'occ': occ
        }
    
doorservo.unlock()

def led_on():
    global led
    GPIO.output(LED_PIN,True)
    led = 1

def led_off():
    global led
    GPIO.output(LED_PIN,False)
    led = 0

def func_recieve():
    
    print '(Thread 1) Listening...'
コード例 #4
0
            'ir': ir,
            'occ': occ
        }

camera = cv2.VideoCapture(0)
    
def update_data():
    global data
    data = {
            'led': led,
            'lock': lock,
            'ir': ir,
            'occ': occ
        }
    
doorservo.unlock()

def led_on():
    global led
    GPIO.output(LED_PIN,True)
    led = 1

def led_off():
    global led
    GPIO.output(LED_PIN,False)
    led = 0

def func_recieve():
    
    print '(Thread 1) Listening...'