Exemplo n.º 1
0
import time

db = MySQLdb.connect()

cur = db.cursor()

# from temp import Temperature
from light import LightSensor
from stepper3 import Stepper

# from valve import Valve
# from servo import Servo

# temp = Temperature()
l1 = LightSensor(17)
motorA = Stepper(14, 15, 18, 23)
motorB = Stepper(24, 25, 8, 7)
motorC = Stepper(11, 9, 10, 23)
# val = Valve(22)
# val.close()
# s1 = Servo()


def bowlPresent():
    x = 0
    while x < 20:
        if l1.visible():
            return False
        x = x + 1

    return True
from stepper3 import Stepper

motorA = Stepper(14, 15, 18, 23)
motorB = Stepper(24, 25, 8, 7)
motorC = Stepper(11, 9, 10, 22)

while True:
    steps = raw_input("How many steps for Motor A? ")
    motorA.rotate(int(steps))

    steps = raw_input("How many steps for Motor B? ")
    motorB.rotate(int(steps))

    steps = raw_input("How many steps for Motor C? ")
    motorC.rotate(int(steps))
Exemplo n.º 3
0
import time

from light import LightSensor
from stepper3 import Stepper

l1 = LightSensor(17)
motorA = Stepper(14, 15, 18, 23)


def bowlPresent():
    x = 0
    while x < 20:
        if l1.visible():
            return False
        x = x + 1

    return True


while True:

    print "Checking for Bowl..."
    # if( bowlPresent() ):
    print "Bowl Present."

    print "Cereal 1"
    time.sleep(1)
    motorA.rotate(25)
    time.sleep(60)
    print "Please Pick Up Bowl"
    # while( l1.visible() == False ):