mercredi 26 février 2020

Can python condition when I can only use 1 variable? [closed]

I'm new in Python,and I want to make a program like button debouncing using state and a to control and I need to used in a looping system

I can only control a,this make i=+1 looped when a = True ,so my question is is there any possible way to use if correctly and make i=+1 only 1 times when I let a = True,and when a = False,set and reset need to be False,so on

code for example:

state =True //a and b controlling,since b is True,so does state
a = //True or false 
b = True
set = False //default
reset = False //default

do{
  if a == True:
    set = True
  if state == True: #problem here,I can only use a,b and state to do condition 
    if set == True:
      reset = True
  if set == True & reset = True :
    i+=1
    set = False
    reset = False


while(1) //infinite loop 

ok I'm so bad at creating a title

Aucun commentaire:

Enregistrer un commentaire