示例#1
0
    def _init_thunderborg(self):
        import ThunderBorg3 as ThunderBorg
        # Init the Thunderborg connection:
        self.TB = ThunderBorg.ThunderBorg()
        self.TB.Init()
        self.TB.MotorsOff()
        self.TB.SetLedShowBattery(True)

        # Setup the ThunderBorg
        if not self.TB.foundChip:
            boards = ThunderBorg.ScanForThunderBorg()
            if len(boards) == 0:
                print("[CONTROLLER] No ThunderBorg found,"
                      " check you are attached :)")
            else:
                print("[CONTROLLER] No ThunderBorg at address"
                      " %02X, but we did find boards:" % (self.TB.i2cAddress))
                for board in boards:
                    print("    %02X (%d)" % (board, board))
                print("[CONTROLLER] If you need to change the I�C address"
                      " change the setup line so it is correct, e.g.")
                print("[CONTROLLER] TB.i2cAddress = 0x%02X" % (boards[0]))
示例#2
0
from approxeng.input.selectbinder import ControllerResource  # Import Approx Eng Controller libraries
import ThunderBorg3 as ThunderBorg
import UltraBorg3 as UltraBorg
#import os
import sys

global launcher
global TB
launcher = False

# Setup the ThunderBorg
TB = ThunderBorg.ThunderBorg()
#TB.i2cAddress = 0x15                 # Uncomment and change the value if you have changed the board address
TB.Init()
if not TB.foundChip:
    boards = ThunderBorg.ScanForThunderBorg()
    if len(boards) == 0:
        print("No ThunderBorg found, check you are attached :)")
    else:
        print("No ThunderBorg at address %02X, but we did find boards:" %
              (TB.i2cAddress))
        for board in boards:
            print("    %02X (%d) " % (board, board))
        print(
            "If you need to change the I2C address change the setup line so it is correct, e.g."
        )
        print("TB.i2cAddress = 0x%02X" % (boards[0]))
    sys.exit()
# Ensure the communications failsafe has been enabled!
failsafe = False
for i in range(5):