Maximite 2: How to make switch trigger only once when pressed


Author Message
jirsoft

Guru

Joined: 18/09/2020
Location: Czech Republic
Posts: 533
Posted: 11:38am 30 Nov 2020      

What about something like:

'initialisation
DIM INTEGER prev = -1


and in function for key:
IF button <> prev THEN
      prev = button
      IF button THEN
             'BUTTON PRESSED!
      ELSE
             'BUTTON DEPRESSED!
      ENDIF
ENDIF