read_input - Kyuchumimo/Micro-Joy-Home-Video-Computer GitHub Wiki

đŸ§ŠđŸ•šī¸ This is a general-purpose input-related function.

read_input() -> <class 'tuple'>

Returns

  • <class 'tuple'>: 2-tuple

Description

This function reads the controls, updates the lists btn0 and btn1 containing the states of the buttons and returns a 2-tuple. If a button has been pressed down on one of the two controls, one of the elements of the tuple will become an integer of that button.

Example

...
while running:
    # INPUT READING
    btnp0, btnp1 = read_input()
...

This function returns a 2-tuple, so it must be unpacked into 2 variables.