Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/python3
- # 10. Program zapalający pasek diod. Długość paska zależna od naciśnietego przycisku (But0->1000, But1->1100, But2-
- # >1110, But3->1111). Jeżeli nie będzie naciśnięty żaden przycisk wszystkie diody powinny być zgaszone. Użyć zapisu
- # heksadecymalnego. W instrukcji warunkowej użyć wywołania funkcji but() (5 razy)
- from board_driver_simulator import open,close,but,pot,det,led
- try:
- open()
- #---------------------
- while(True): #pętla nieskończona
- state=but()
- if (but()==0):
- led(1)
- elif (but()==1):
- led(1)
- led(2)
- elif(but()==2):
- led(1)
- led(2)
- led(4)
- elif (but()==3):
- led(1)
- led(2)
- led(4)
- led(8)
- else:
- (but())
- #---------------------
- finally:
- close()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement