def playback_instruction(pin_type, pin_index, value): if pin_type == "d": # print "DIGITAL, PIN_INDEX: ", pin_index, "VALUE: ", value mctransmitter.tx_digital(pin_index, value) elif pin_type == "a": # print "ANALOG, PIN_INDEX: ", pin_index, "VALUE: ", value mctransmitter.tx_analog(pin_index, value)
def update(self, button_type, button_index, button_value): if (button_type == global_data.TYPE_BUTTON): if (button_index == global_data.BUTTON_X): mctransmitter.tx_digital(0, button_value) elif (button_index == global_data.BUTTON_Y): mctransmitter.tx_digital(1, button_value) elif ((button_index == global_data.BUTTON_A) and button_value): mctransmitter.tx_digital(0, not global_data.digital_0_sent) elif ((button_index == global_data.BUTTON_B) and button_value): mctransmitter.tx_digital(1, not global_data.digital_1_sent) elif (button_type == global_data.TYPE_AXIS): if (button_index == global_data.AXIS_LEFT_TRIGGER): tx_value = 127 - (button_value / 2) mctransmitter.tx_analog(0, tx_value) if (button_index == global_data.AXIS_RIGHT_TRIGGER): tx_value = 127 if (button_value > 0.0): tx_value = 128 + (button_value / 2) mctransmitter.tx_analog(0, tx_value)
import mctransmitter mctransmitter.initialize() mctransmitter.tx_analog(0,0) mctransmitter.tx_analog(1,0) mctransmitter.tx_digital(0,0) mctransmitter.tx_digital(1,0)