Пример #1
0
def configure():
    
    # Sets "variable mode" to global in function configure()
    global arg1
    global arg2
    
    # Initializes GPIO pins. Greeting is customized for each Rover
    if(arg2 == "-two"):
        roverNumber = "Two"
        print("Welcome to Rover " + roverNumber + ", initialization sequence will now commence.")
        RoverCONF.gpioInitialize(arg1)

    elif(arg2 == "-one"):
        roverNumber = "One"
        print("Welcome to Rover " + roverNumber + ", initialization sequence will now commence.")
        RoverCONF.gpioInitialize(arg1)
    
    # Handles unexpected errors
    else:
        print("Startup Error! Restart")
Пример #2
0
    # Initializes GPIO pins. Greeting is customized for each Rover
    if(arg2 == "-two"):
        roverNumber = "Two"
        print("Welcome to Rover " + roverNumber + ", initialization sequence will now commence.")
        RoverCONF.gpioInitialize(arg1)

    elif(arg2 == "-one"):
        roverNumber = "One"
        print("Welcome to Rover " + roverNumber + ", initialization sequence will now commence.")
        RoverCONF.gpioInitialize(arg1)
    
    # Handles unexpected errors
    else:
        print("Startup Error! Restart")

# Calls function configure() to start the process
configure()

# Parses list of the GPIO pin number values set in RoverCONF.py into a string (final_list), then strips it of "[]" and commas so that it can be transformed back into a list later
final_list = str(RoverCONF.gpioListify()).strip('[]')
final_list = final_list.replace(",", "")

# Makes file "cache_bodge.ext" in the working directory in order to save "final_list" in it for future use by other functions and python scripts
# Enables importing of RoverCONF.py wthout losing GPIO pin number values.
new_file = open("cache_bodge.ext", "w")
new_file.write(final_list)

import RoverNAV
RoverNAV.ultrasoundInitialization()
RoverNAV.roverNavigate()