예제 #1
0
def createMotor(pin1, pin2, pin3, pin4, command_index):
    pin1 = int(pin1)
    pin2 = int(pin2)
    pin3 = int(pin3)
    pin4 = int(pin4)
    command_index = int(command_index)

    motor = Motor([pin1, pin2, pin3, pin4], 15)
    motor.move_to(180)
예제 #2
0
def createMotor(pin1, pin2, pin3, pin4, command_index):
	pin1 = int(pin1)
	pin2 = int(pin2)
	pin3 = int(pin3)
	pin4 = int(pin4)
	command_index = int(command_index)

	motor = Motor([pin1,pin2,pin3,pin4], 15)
	motor.move_to(180)
예제 #3
0
    def __init__(self, pin1, pin2, pin3, pin4, command_index):
        threading.Thread.__init__(self)
        self.pin1 = int(pin1)
        self.pin2 = int(pin2)
        self.pin3 = int(pin3)
        self.pin4 = int(pin4)
        self.command_index = int(command_index)

        self.motor = Motor(
            [int(self.pin1),
             int(self.pin2),
             int(self.pin3),
             int(self.pin4)], 15)
예제 #4
0
class MotorThread(threading.Thread):
	def __init__(self, pin1, pin2, pin3, pin4, command_index):
		threading.Thread.__init__(self)
		self.pin1 = int(pin1)
		self.pin2 = int(pin2)
		self.pin3 = int(pin3)
		self.pin4 = int(pin4)
		self.command_index = int(command_index)

		self.motor = Motor([int(self.pin1), int(self.pin2), int(self.pin3), int(self.pin4)], 15)

	def run(self):
		self.motor.move_to(90)
예제 #5
0
class MotorThread(threading.Thread):
    def __init__(self, pin1, pin2, pin3, pin4, command_index):
        threading.Thread.__init__(self)
        self.pin1 = int(pin1)
        self.pin2 = int(pin2)
        self.pin3 = int(pin3)
        self.pin4 = int(pin4)
        self.command_index = int(command_index)

        self.motor = Motor(
            [int(self.pin1),
             int(self.pin2),
             int(self.pin3),
             int(self.pin4)], 15)

    def run(self):
        self.motor.move_to(90)
예제 #6
0
	def __init__(self, pin1, pin2, pin3, pin4, command_index):
		threading.Thread.__init__(self)
		self.pin1 = int(pin1)
		self.pin2 = int(pin2)
		self.pin3 = int(pin3)
		self.pin4 = int(pin4)
		self.command_index = int(command_index)

		self.motor = Motor([int(self.pin1), int(self.pin2), int(self.pin3), int(self.pin4)], 15)
예제 #7
0
#!/usr/bin/python

from Stepper import Motor
from time import sleep
import RPi.GPIO as GPIO
import sys

if __name__ == "__main__":
    GPIO.setmode(GPIO.BOARD)

    m = Motor([
        int(sys.argv[1]),
        int(sys.argv[2]),
        int(sys.argv[3]),
        int(sys.argv[4])
    ], 15)

    # clock 180
    m.move_to(180)
    sleep(0.2)
    m.move_to(270)
    sleep(0.5)
    m.move_to(0)
    m.move_to(-90)
    GPIO.cleanup()
예제 #8
0
#!/usr/bin/python

from Stepper import Motor
import RPi.GPIO as GPIO
import sys

if __name__ == "__main__":
    GPIO.setmode(GPIO.BOARD)

    pin1 = int(sys.argv[1])
    pin2 = int(sys.argv[2])
    pin3 = int(sys.argv[3])
    pin4 = int(sys.argv[4])
    direction = int(sys.argv[5])
    angle = int(sys.argv[6])

    m = Motor([pin1, pin2, pin3, pin4], 15)
    if direction == -1:
        m.move_acw(angle)

    GPIO.cleanup()
예제 #9
0
#!/usr/bin/python

from Stepper import Motor
from time import sleep
import RPi.GPIO as GPIO
import sys


if __name__ == "__main__":
	GPIO.setmode(GPIO.BCM)

	m = Motor([18,23,24,25], 15)

	# clock 180
	m.move_to(20)


예제 #10
0
#!/usr/bin/python

from Stepper import Motor
import RPi.GPIO as GPIO
import sys


if __name__ == "__main__":
    GPIO.setmode(GPIO.BOARD)

    pin1 = int(sys.argv[1])
    pin2 = int(sys.argv[2])
    pin3 = int(sys.argv[3])
    pin4 = int(sys.argv[4])
    direction = int(sys.argv[5])
    angle = int(sys.argv[6])

    m = Motor([pin1, pin2, pin3, pin4], 15)
    if direction == -1:
        m.move_acw(angle)

    GPIO.cleanup()
예제 #11
0
#!/usr/bin/python

from Stepper import Motor
from time import sleep
import RPi.GPIO as GPIO
import sys


if __name__ == "__main__":
	GPIO.setmode(GPIO.BOARD)

	m = Motor([int(sys.argv[1]),int(sys.argv[2]),int(sys.argv[3]),int(sys.argv[4])], 15)

	# clock 180
	m.move_to(180)
	sleep(0.2)
	m.move_to(270)
	sleep(0.5)
	m.move_to(0)
	m.move_to(-90)
	GPIO.cleanup()

예제 #12
0
# It is in the public domain, so you can do what you like with it
# but a link to http://scphillips.com would be nice.

import socket
import re
from datetime import datetime
import pygame
import argparse
import RPi.GPIO as GPIO
from Stepper import Motor

# CONFIGURATION BEGINS ########################################

# Set up stepper-motor:
GPIO.setmode(GPIO.BOARD)
motor = Motor([18, 22, 24, 26])
motor.rpm = 5

# Set up the clock locations:
location = {
    'home': 0,
    'woodcraft':
    45,  # A cooperative childrens' organisation, see http://woodcraft.org
    'work': 90,
    'pub': 135,  # this is more of an aspiration than a location
    'salsa': 180,
    'pilates': 225,
    'travelling': 270,
    'mortalperil': 315,  # traditionally must be included
}
예제 #13
0
# It is in the public domain, so you can do what you like with it
# but a link to http://scphillips.com would be nice.

import socket
import re
from datetime import datetime
import pygame
import argparse
import RPi.GPIO as GPIO
from Stepper import Motor

# CONFIGURATION BEGINS ########################################

# Set up stepper-motor:
GPIO.setmode(GPIO.BOARD)
motor = Motor([18,22,24,26])
motor.rpm = 5

# Set up the clock locations:
location = {
    'home': 0,
    'woodcraft': 45,  # A cooperative childrens' organisation, see http://woodcraft.org
    'work': 90,
    'pub': 135,  # this is more of an aspiration than a location
    'salsa': 180,
    'pilates': 225,
    'travelling': 270,
    'mortalperil': 315,  # traditionally must be included
    }

# Port for the web server to run on
예제 #14
0
        timestamp = datetime.datetime.now()
        cv2.putText(
            frame,
            timestamp.strftime("%A %d %B %Y %I:%M:%S%p"),
            (10, frame.shape[0] - 10),
            cv2.FONT_HERSHEY_SIMPLEX,
            0.35,
            (0, 0, 255),
            1,
        )


outputFrame = None
lock = threading.Lock()
vs = cv2.VideoCapture(0)
doorLock = Motor()
shouldLock = True
web = Website()
recognizer = Recognizer()
database = Database()
processFrame = False
count = 0
name = "No one"
changeLockState = False
initTimer = True
unlockTimer = threading.Timer(0.1, doorLock.lock)

# Checks to see if this is the main thread of execution
# start a thread that will perform motion detection
# start the flask ap