コード例 #1
0
def Gpio_Intent(status,room):
    GPIO.setwarnings(False)
    if 1 :
        dispenser = Dispenser()
        
    else:
        dispenser = TestDispenser()
        
    if status in STATUSON:
        return statement('turning {} Pestle Home'.format(status))
    elif status in STATUSOFF:
        return statement('turning {} Pestle Home'.format(status))
    elif status in STATUSPROTIEN:
        dispenser.dispense(0, 3)
        dispenser.clean_and_exit()
        return statement('dispensing {} from Pestle Home'.format(status))
    elif status in STATUSCHIA:
        dispenser.move(1)
        dispenser.dispense(1, 3)
        dispenser.calibrate_track()
        dispenser.clean_and_exit()
        return statement('dispensing {} from Pestle Home'.format(status))
    elif status in STATUSLEMONADE:
        dispenser.dispense(0, 3)
        dispenser.clean_and_exit()
        return statement('dispensing {} from Pestle Home'.format(status))
    elif status in STATUSSHAKE:
        dispenser.dispense(0, 3)
        dispenser.move(1)
        dispenser.dispense(1, 3)
        dispenser.calibrate_track()
        dispenser.clean_and_exit()
        return statement('dispensing {} from Pestle Home'.format(status))
    else:
        return statement('Sorry {} is not possible Right now'.format(status))
コード例 #2
0
ファイル: test_main.py プロジェクト: clintrf/pestle_master
    return return_dict


def userInput(diction, index):
    index = str(index)
    x = int(diction[index][0])
    y = int(diction[index][1])
    amount = int(diction[index][2])
    return x, y, amount


if __name__ == "__main__":

    dispenser = Dispenser()
    #dispenser = TestDispenser()
    dispenser.calibrate_track()
    dispenser.calibrate_scale(100)

    command = text_parser("input.txt")
    x, y, amount = userInput(command, 1)

    while ((x != 3) & (y != 3)):
        for i in range(1, len(command)):
            dispenser.move(x, y)
            dispenser.dispense(amount)
            dispenser.calibrate_track()
            dispenser.calibrate_scale(100)
            x, y, amount = userInput(command, i + 1)

        #x = 3
        #y = 3