Пример #1
0
import config


def test(self):
    # function: print test
    print("\nTest Function!")


if __name__ == "__main__":

    # initializing  classes and pins
    print("\nInitializing Classes & Pins")
    home_switch = Digital_Io(config.limit_home_pin, "in")  # NEVER DELETE
    end_switch = Digital_Io(config.limit_end_pin, "in")  # NEVER DELETE
    home_switch.add_event("fall")
    end_switch.add_event("fall")
    force_pwr = Digital_Io(config.force_pins, "out", 0)
    force_sig = Analog_In(config.force_pins)

    # confirming power
    input("Press any key after motors are connected to power")

    for i in range(10, 0, -1):
        print(i, "secs left")
        time.sleep(1)

    # cleaning up pins
    print("\nCleaning up pins")
    home_switch.cleanup()  # NEVER DELETE
    end_switch.cleanup()  # NEVER DELETE
Пример #2
0
                input(
                    "\nEnter test name [r=read, f=filter read, rn=read nonstop] \
                    \nOR [n] to exit program: "))
        except ValueError:
            print("Error: Invalid Input")
            continue
        if response == "r":
            read()
            continue
        elif response == "f":
            values = int(
                input(
                    "Enter amount of values for running sum filter [6 is a good start]: "
                ))
            filter(values)
            continue
        elif response == "rn":
            read_nonstop()
            continue
        elif response == "n":
            break
        else:
            print("Error: Try again")
            continue

    print("\nClosing Program")
    force_pwr.output(0)
    home_switch.cleanup()  # NEVER DELETE
    end_switch.cleanup()  # NEVER DELETE
    force_pwr.cleanup()  # NEVER DELETE