# Voting Machine # input 14 and 15 from machine import Pin from time import sleep_ms PlayerA = Pin(15, Pin.IN, Pin.PULL_UP) PlayerB = Pin(14, Pin.IN, Pin.PULL_UP) A = 1 B = 1 Na = 0 Nb = 0 time = 0 while(1): zA = A A = PlayerA.value() zB = B B = PlayerB.value() if( (A==1) & (zA==0) ): Na += 1 if( (B==1) & (zB==0) ): Nb += 1 print('Votes for A ',Na, ' Votes for B ',Nb) sleep_ms(100)