示例#1
0
 def __init__(self, reset_time=2.0, button="P2_2", i2c_bus=1, i2c_address=0x70):
     """ Initialize variables and set up display """
     self.reset_time = reset_time
     self.button     = button
     self.display    = HT16K33.HT16K33(i2c_bus, i2c_address)
     
     self._setup()
示例#2
0
 def __init__(self, reset_time=2.0, button="P2_2", 
                    red_led="P2_6", green_led="P2_4",
                    analog_in="P1_19", servo="P1_36", 
                    i2c_bus=1, i2c_address=0x70):
     """ Initialize variables and set up display """
     self.reset_time = reset_time
     self.button     = button
     self.red_led    = red_led
     self.green_led  = green_led
     self.analog_in  = analog_in
     self.servo      = servo
     self.display    = HT16K33.HT16K33(i2c_bus, i2c_address)
     
     self._setup()
示例#3
0
    def __init__(self,
                 reset_time=1.5,
                 button=SWITCH_PIN,
                 x_analog=X_ANALOG_PIN,
                 y_analog=Y_ANALOG_PIN,
                 i2c_bus=1,
                 i2c_address=0x70,
                 piezzo=PIEZZO_BUZZER_PWM):
        """ Initialize variables"""
        self.reset_time = reset_time
        self.button = button
        self.xmove = x_analog
        self.ymove = y_analog
        self.piezzo = piezzo
        self.display = HT16K33.HT16K33(i2c_bus, i2c_address)
        self.game_sound = PiezzoBuzzer.AsteroidsSound()
        self.game_display = RGBMatrixDisplay.MatrixDisplay(32, 32)

        self._setup()
示例#4
0
    def __init__(self,
                 speaker_0="P1_36",
                 speaker_1="P2_3",
                 speaker_2="P2_1",
                 C="P1_27",
                 D="P1_19",
                 E="P1_21",
                 F="P1_23",
                 G="P1_25",
                 A="P2_35",
                 B="P2_36",
                 i2c_bus=1,
                 i2c_address=0x70,
                 motor="P1_33"):
        """
        Intializes variables to appropriate pins
        """
        # initialize speaker pins
        self.speaker_0 = speaker_0
        self.speaker_1 = speaker_1
        self.speaker_2 = speaker_2

        # initialize note pins
        #self.note_pins['A'] = A
        self.note_pins['B'] = B
        self.note_pins['C'] = C
        self.note_pins['D'] = D
        self.note_pins['E'] = E
        self.note_pins['F'] = F
        self.note_pins['G'] = G

        # initialize 7-segment display
        self.display = HT16K33.HT16K33(i2c_bus, i2c_address)

        # Initialize motor pin
        self.motor = motor

        # setup all of the pins
        self._setup()