예제 #1
0
import cv2
import RPi.GPIO as GPIO
import numpy as np
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
from simple_pid import PID
import mount

mount.setpan(90)
mount.settilt(120)

enable1 = 24
enable2 = 21
in3 = 22
in2 = 18
in4 = 27
in1 = 17
GPIO.setmode(GPIO.BCM)
#motor contoller begin
GPIO.setup(enable1, GPIO.OUT)
GPIO.setup(enable2, GPIO.OUT)
GPIO.setup(in1, GPIO.OUT)
GPIO.setup(in2, GPIO.OUT)
GPIO.setup(in3, GPIO.OUT)
GPIO.setup(in4, GPIO.OUT)
pwm1 = GPIO.PWM(enable1, 100)  # Created a PWM object
pwm2 = GPIO.PWM(enable2, 100)
pwm1.start(40)  #right wheel
pwm2.start(40)  #left wheel
GPIO.output(in1, True)
import cv2
import RPi.GPIO as GPIO
import numpy as np
from picamera.array import PiRGBArray
from picamera import PiCamera
import time
from simple_pid import PID
import mount #for camera mount
import ultra #for distance sensor
import os
os.system('sudo python ledwhite.py')
white=True

mount.setpan(88)
mount.settilt(120)

enable1=24
enable2=21
in3=22
in2=13
in4=27
in1=17
GPIO.setmode(GPIO.BCM)
#motor contoller begin
GPIO.setup(enable1,GPIO.OUT)
GPIO.setup(enable2,GPIO.OUT)
GPIO.setup(in1,GPIO.OUT)
GPIO.setup(in2,GPIO.OUT)
GPIO.setup(in3,GPIO.OUT)
GPIO.setup(in4,GPIO.OUT)
pwm1 = GPIO.PWM(enable1,100)    # Created a PWM object