Unterschiede
Hier werden die Unterschiede zwischen zwei Versionen der Seite angezeigt.
| Beide Seiten, vorherige Überarbeitung Vorherige Überarbeitung Nächste Überarbeitung | Vorherige Überarbeitung | ||
| gf_informatik:microbit_programmieren_loesungen [2021-08-30 07:00] – [Aufgaben A] gra | gf_informatik:microbit_programmieren_loesungen [2022-08-10 11:24] (aktuell) – gelöscht sca | ||
|---|---|---|---|
| Zeile 1: | Zeile 1: | ||
| - | ====== Microbit programmieren: | ||
| - | |||
| - | ==== Aufgaben A ==== | ||
| - | |||
| - | === A1 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | display.show(Image.DUCK) | ||
| - | </ | ||
| - | |||
| - | === A2 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | myImages = [Image.SAD, Image.MEH, Image.YES, Image.NO, Image.COW] | ||
| - | |||
| - | display.show(myImages, | ||
| - | </ | ||
| - | |||
| - | === A3 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | all_1 = Image(" | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | all_3 = Image(" | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | all_5 = Image(" | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | all_7 = Image(" | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | all_9 = Image(" | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | " | ||
| - | |||
| - | myImages = [all_1, all_3, all_5, all_7, all_9] | ||
| - | |||
| - | display.show(myImages, | ||
| - | </ | ||
| - | |||
| - | === A4 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | for brightness in range(1, | ||
| - | sleep(200) | ||
| - | for column in range(5): | ||
| - | for row in range (5): | ||
| - | display.set_pixel(column, | ||
| - | </ | ||
| - | |||
| - | ==== Aufgaben B ==== | ||
| - | |||
| - | === B1 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | if button_a.is_pressed(): | ||
| - | display.show(Image.GHOST) | ||
| - | if button_b.is_pressed(): | ||
| - | display.show(Image.RABBIT) | ||
| - | if pin_logo.is_touched(): | ||
| - | display.clear() | ||
| - | </ | ||
| - | |||
| - | === B2 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | if button_a.is_pressed(): | ||
| - | display.scroll(" | ||
| - | if button_b.is_pressed(): | ||
| - | display.show(Image.RABBIT) | ||
| - | if pin_logo.is_touched(): | ||
| - | display.clear() | ||
| - | </ | ||
| - | |||
| - | === B3 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | if button_a.is_pressed(): | ||
| - | display.scroll(" | ||
| - | if button_b.is_pressed(): | ||
| - | display.show(Image.RABBIT) | ||
| - | if pin_logo.is_touched(): | ||
| - | display.clear() | ||
| - | </ | ||
| - | |||
| - | === B4 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | if button_a.is_pressed(): | ||
| - | display.show(Image.HAPPY) | ||
| - | elif button_b.is_pressed(): | ||
| - | display.show(Image.SAD) | ||
| - | elif pin_logo.is_touched(): | ||
| - | display.show(Image.HEART) | ||
| - | else: | ||
| - | display.clear() | ||
| - | </ | ||
| - | |||
| - | === B5 === | ||
| - | <code python> | ||
| - | from microbit import * | ||
| - | |||
| - | while True: | ||
| - | if pin_logo.is_touched(): | ||
| - | display.scroll(str(button_a.get_presses()-button_b.get_presses())) | ||
| - | </ | ||
| - | |||