Advertisement
rric

bilder_und_tasten

Jan 9th, 2024 (edited)
30
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.78 KB | None | 0 0
  1. # Zeigt bei Tastendruck verschiedene Bilder an
  2. # Copyright 2023, 2024 Roland Richter                [Mu: BBC micro:bit]
  3.  
  4. import microbit
  5.  
  6. while True:
  7.     if microbit.button_a.is_pressed():
  8.         # MicroPython hat viele vordefinierte Bilder, aber manche davon
  9.         # (z.B. ←) gibt's in OpenRoberta nicht. Hier aber kann ich einfach
  10.         microbit.display.show(microbit.Image.ARROW_W)
  11.         # schreiben. Die Liste aller vordefinierten Bilder gibt's auf
  12.         # https://microbit-micropython.readthedocs.io/en/latest/tutorials/images.html
  13.  
  14.     elif microbit.button_b.is_pressed():
  15.         # Der Text unten soll so ähnlich wie ein 5x5 Pixel großer → aussehen
  16.         microbit.display.show(microbit.Image("00900:"
  17.                                              "00090:"
  18.                                              "99999:"
  19.                                              "00090:"
  20.                                              "00900"))
  21.     else:
  22.         microbit.display.clear()
  23.  
  24.     # PROBIERE, das Zeichen ↔ anzuzeigen, wenn beide Tasten gleichzeitig gedrückt sind.
  25.  
  26. # ----------------------------------------------------------------------
  27. # This program is free software: you can redistribute it and/or modify
  28. # it under the terms of the GNU General Public License as published by
  29. # the Free Software Foundation, either version 3 of the License, or
  30. # (at your option) any later version.
  31. #
  32. # This program is distributed in the hope that it will be useful,
  33. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  34. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  35. # GNU General Public License for more details.
  36. #
  37. # You should have received a copy of the GNU General Public License
  38. # along with this program.  If not, see <https://www.gnu.org/licenses/>.
  39.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement