Beispiel #1
0
import max7219.led as led
from temp import *
from servosix import ServoSix
import time

ss = ServoSix()
device = led.matrix()
device.orientation(180)

min_temp, max_temp = 15, 45
min_servo, max_servo = 0, 180


def servoScale(val):
    temp_range = (max_temp - min_temp)
    servo_range = (max_servo - min_servo)

    servo_val = (((val - min_temp) * servo_range) / temp_range) + min_servo
    return servo_val


while True:
    time.sleep(1)
    temp = temp_from_r(read_resistance())
    device.show_message("{0:0.0f}".format(temp))
    s = servoScale(temp)
    ss.set_servo(1, (180 - s))
    print("{0:0.0f}".format(temp))
Beispiel #2
0
import time
from servosix import ServoSix

ss = ServoSix()

try:
    while True:
        servo = input("servo:")
        angle = input("angle:")
        ss.set_servo(servo, angle)

finally:
    ss.cleanup()
Beispiel #3
0
from servosix import ServoSix
import time

ss = ServoSix()

ss.set_servo(1, 90)
ss.set_servo(2, 90)
ss.set_servo(3, 90)
ss.set_servo(4, 90)

time.sleep(1)

print("Servos in 90 degree position")

ss.cleanup()
Beispiel #4
0
from servosix import ServoSix
import time

ss = ServoSix()

period = 0.5

try:
    while (True):
        ss.set_servo(1, 0)
        time.sleep(period)
        ss.set_servo(1, 180)
        time.sleep(period)

finally:
    ss.cleanup()
Beispiel #5
0
    vErathIn * np.cos(betaz * rads) * np.sin((sunsEclLong2 - lamdaz) * rads)
]
vroteq = 0.465102

vEarthRotLAB = [0., -vroteq * np.cos(LABLat * rads), 0.]
cygnusLAB = GALtoLAB.dot(np.add(np.add(vGalRotGAL, vEarthRevGAL),
                                vSolMotGAL)) + vEarthRotLAB
norm = np.linalg.norm(cygnusLAB)
cygnusLAB = cygnusLAB / norm

azim = math.atan2(cygnusLAB[1], cygnusLAB[0])
azim = FNrange(-azim)
altit = np.arcsin(cygnusLAB[2])

# print "time = ", year, month ,day ,hour
# print "azim ",azim
# print "altit ",altit

position_servo1 = (pi - FNrange(azim + correction)) * degs
position_servo2 = (2 * pi - FNrange(azim + correction)) * degs

if FNrange(azim + correction) < pi:
    ss.set_servo(2, altit * degs)
    ss.set_servo(1, position_servo1)
else:
    ss.set_servo(2, (pi - altit) * degs)
    ss.set_servo(1, position_servo2)

#print "pos_se1 ",position_servo1
#print "pos_se2",position_servo2
from servosix import ServoSix
import time
import numpy as np
import math
import FaBo9Axis_MPU9250
import time
import sys
import datetime
mpu9250 = FaBo9Axis_MPU9250.MPU9250()

ss = ServoSix()
i=0
while i <2:

    for j in range (80,110):
        ss.set_servo(1,j)
        time.sleep(0.05)
    for j in range (80,110):
        ss.set_servo(1,180-j)
        time.sleep(0.05)
    
    i+=1
Beispiel #7
0
class GongBerry:
    def __init__(self, numRatches):
        if numRatches < 1 or numRatches > 20:
            raise ValueError('Needs to be between 1 and 20')

        self.numRatches = numRatches
        self.ss = ServoSix()
        self.period = 0.7

    def open(self):
        self.ss.set_servo(2, 170)
        time.sleep(self.period)
        self.ss.set_servo(1, 0)

    def close(self):
        self.ss.set_servo(2, 150)
        self.ss.set_servo(1, 90)

    def rat(self):
        self.ss.set_servo(2, 150)
        time.sleep(self.period)
        self.ss.set_servo(2, 50)
        time.sleep(self.period)

    def doit(self):
        try:
            self.close()
            for x in range(self.numRatches):
                self.rat()
            self.open()
        finally:
            self.ss.cleanup()
            time.sleep(1)
Beispiel #8
0
            time.sleep(4)
            GPIO.output(PIN, GPIO.HIGH)
            #print(" Pump OFF")
            time.sleep(0.1)
        else:
            GPIO.output(PIN, GPIO.HIGH)
            water = "false"
            #print(" Pump OFF")
            time.sleep(0.1)

        humidity, temp_inside = Adafruit_DHT.read_retry(sensor1, 26)
        temp_outside = sensor.get_temperature()
        time_now = datetime.now()

        if temp_inside > temp_inside_max:
            ss.set_servo(6, 60)
            window = "true"
            #print("doors open")
        else:
            ss.set_servo(6, 103)
            window = "false"
            #print("doors closed")

        data = {
            "temp_out": math.floor(temp_outside * 100) / 100,
            "temp_inside": math.floor(temp_inside * 100) / 100,
            "soil_moist": soil_moist,
            "humidity": math.floor(humidity * 100) / 100,
            "window": window,
            "water": water,
            "created_at": str(time_now)
Beispiel #9
0
from servosix import ServoSix
import time

ss = ServoSix()

period = 0.5

try:
    while True:
        ss.set_servo(1, 0)
        time.sleep(period)
        ss.set_servo(1, 180)
        time.sleep(period)

finally:
    ss.cleanup()
Beispiel #10
0
def GUI():
    #from voyeur import *
    import voyeur
    root = tk.Tk()  # main window
    root.title("Team 1 - San Marcos")
    root.geometry("1270x650+0+0")  

    label1 = Label(root, text="Security Camera")
    label1.grid(row=0, column=0, columnspan=4)
    

    button1 = Button(root, text="Camera On", width=22, command=lambda: voyeurPreviewON())
    button1.grid(row=1, column=0, columnspan=4)

    button2 = Button(root, text="Camera Off", width=22, command=lambda: voyeurPreviewOFF())
    button2.grid(row=2, column=0, columnspan=4)

    button3 = Button(root, text="Take a Photo", width=22, command=lambda: voyeurPicture())
    button3.grid(row=3, column=0, columnspan=4)
    
    button4 = Button(root, text="Slideshow - Images Folder", width=22, command=lambda: slideShow())
    button4.grid(row=4, column=0, columnspan=4)

    button5 = Button(root, text="Start Video Record", width=22, command=lambda: voyeurRecordON())
    button5.grid(row=5, column=0, columnspan=4)

    button6 = Button(root, text="Stop Video Record", width=22, command=lambda: voyeurRecordOFF())
    button6.grid(row=6, column=0, columnspan=4)

    button7 = Button(root, text="Play Last Recorded Video", width=22, command=lambda: playVid())  
    button7.grid(row=7, column=0, columnspan=4)

    button8 = Button(root, text=" 4:3 ", width=9, command=lambda: widescreen())
    button8.grid(row=8, column=0, columnspan=2)

    button9 = Button(root, text=" 16:9 ", width=9, command=lambda: normal())
    button9.grid(row=8, column=2, columnspan=2)

    button10 = Button(root, text="brightness +", width=9, command=lambda: voyeurBrightnessUP())
    button10.grid(row=9, column=0, columnspan=2)

    button11 = Button(root, text="brightness -", width=9, command=lambda: voyeurBrightnessDOWN())
    button11.grid(row=9, column=2, columnspan=2)

    button12 = Button(root, text="contrast +", width=9, command=lambda: voyeurContrastUP())
    button12.grid(row=10, column=0, columnspan=2)

    button13 = Button(root, text="contrast -", width=9, command=lambda: voyeurContrastDOWN())
    button13.grid(row=10, column=2, columnspan=2)

    button14 = Button(root, text="Exit", width=22, command=lambda: bye())
    button14.grid(row=11, column=0, columnspan=4)

    label2 = Label(root, text="-------------------------------------------------")
    label2.grid(row=12, column=0, columnspan=4)

    ss = ServoSix()
    ss.set_servo(1, 90)
    ss.set_servo(2, 90)

    label3 = Label(root, text=" ")
    label3.grid(row=13, column=0, columnspan=4)

    button13_1 = Button(root, text="90 deg", width=3, command=lambda: rotate())
    button13_1.grid(row=14, column=0)
    button19 = Button(root, text="Center", width=6, command=lambda: center(ss))
    button19.grid(row=14, column=1, columnspan=2)
    button20 = Button(root, text="Pan", width=3, command=lambda: pan(ss))
    button20.grid(row=14, column=3)

    label3 = Label(root, text="SERVO CONTROLS")
    label3.grid(row=13, column=1, columnspan=2)

    button13 = Button(root, text="UP", width=3, command=lambda: up(ss))
    button13.grid(row=15, column=0)
    button14 = Button(root, text="DOWN", width=3, command=lambda: down(ss))
    button14.grid(row=15, column=1)
    button15 = Button(root, text="LEFT", width=3, command=lambda: left(ss))
    button15.grid(row=15, column=2)
    button16 = Button(root, text="RIGHT", width=3, command=lambda: right(ss))
    button16.grid(row=15, column=3)
    
    label4 = Label(root, text="")
    label4.grid(row=16, column=1, columnspan=2)
    
    label5 = Label(root, text="Team Voyeur")
    label5.grid(row=17, column=1, columnspan=2)
    
    label6 = Label(root, text="")
    label6.grid(row=18, column=1, columnspan=2)
    
    label7 = Label(root, text="4398 SM Team #1")
    label7.grid(row=19, column=1, columnspan=2)
    
    label7 = Label(root, text="")
    label7.grid(row=20, column=1, columnspan=2)
    
    label7 = Label(root, text="<<< Authors >>>")
    label7.grid(row=21, column=1, columnspan=2)
    
    label8 = Label(root, text="Alvin Romualdo")
    label8.grid(row=22, column=1, columnspan=2)
    
    label9 = Label(root, text="Russell Bennight")
    label9.grid(row=23, column=1, columnspan=2)
    
    label10 = Label(root, text="Jordan Al Sahili")
    label10.grid(row=24, column=1, columnspan=2)
    
    label11 = Label(root, text="Maxwell Yi")
    label11.grid(row=25, column=1, columnspan=2)
    
    img = Image.open("/home/pi/Desktop/Under Construction/Spyguy")
    img = img.resize((200, 200), Image.ANTIALIAS)
    img = ImageTk.PhotoImage(img)
    panel = Label(root, image = img)
    panel.grid(row=17, column=0, columnspan=4)
    
    root.mainloop()  # display the GUI
    voyeurPreviewOFF()
Beispiel #11
0
import max7219.led as led 
from temp import *
from servosix import ServoSix 
import time

ss = ServoSix()
device = led.matrix()
device.orientation(180)

min_temp, max_temp = 15, 45
min_servo, max_servo = 0, 180


def servoScale(val):
	temp_range = (max_temp - min_temp)
	servo_range = (max_servo - min_servo)

	servo_val = (((val - min_temp)*servo_range) / temp_range) + min_servo
	return servo_val

while True:
	time.sleep(1)
	temp = temp_from_r(read_resistance())
	device.show_message("{0:0.0f}".format(temp))
	s = servoScale(temp)
	ss.set_servo(1, (180-s))
	print("{0:0.0f}".format(temp))