def main(): # ''' # This is only run if you run the file directly #''' GPIO.setmode( GPIO.BOARD) # Set the GPIO pins as numbering - Also set in drive.py GPIO.setwarnings(False) drive.init() spi.init() dalek_settings = settings.Settings() dalek_settings.slow_mode() dalek_settings # try: start(dalek_settings)
def setup(): # Setup GPIO and initialize Imports debug.turn_debug_on() # use the debug and turn on output # if left empty then default is just stout debug.set_output_device("scrollphat") dalek_sounds.set_volume_level(-5) # values: -20 to 10 dalek_sounds.play_sound("Beginning") # annoy someone # Set the GPIO pins as numbering - Also set in drive.py GPIO.setmode(GPIO.BOARD) # Turn GPIO warnings off - CAN ALSO BE Set in drive.py GPIO.setwarnings(False) drive.init() # Initialise the software to control the motors spi.init() # Initialise my software for the MOSI/spi Bus controller.init() # Initialise the controller
def main(): ''' This is only run if you run the file directly ''' GPIO.setmode( GPIO.BOARD) # Set the GPIO pins as numbering - Also set in drive.py GPIO.setwarnings(False) spi.init() dalek_settings = settings.Settings() dalek_settings.slow_mode() drive.init() dalek_sounds = sound_player.Mp3Player(True) # initialize the sound player debug.debug_on = True debug.print_to_all_devices("working", "OK") try: straight_line_speed_test(dalek_settings, dalek_sounds) time.sleep(1) except: print("!!! error") drive.cleanup()
import sys from os import path sys.path.append(path.dirname(path.dirname(path.abspath(__file__)))) import time from dalek import spi from dalek import drive import RPi.GPIO as GPIO # Import GPIO divers GPIO.setwarnings(False) drive.init() speed = 50 spi.init() ## raise the bot off the wheels and see how the mag changes when this is run. mySleepTime = 0.3 #this is the time in the middle that it sleeps for change this to see what works best for you. # also do some tests with the drive functions to see if they make any difference # this might be the time it takes to refresh the value on the Arduino greatestMag = 0 mag = spi.getMag() print("\n#################\n\ninitial value:{}".format(mag)) speed = 0 def speedtest():