Program ar merour c’hoari

from microbit import *
import radio

radio.on()

while True:
    display.show(Image.DIAMOND)
    while True:
        if button_a.is_pressed():
            radio.send("start")
            break
        sleep(1)

    # Kroget eo ar c'hoari !
    display.show(Image.TRIANGLE)

    # Reseviñ respontoù ar c'hoarierienn
    while True:
        incoming = radio.receive()
        if incoming:
            radio.send(incoming)
            display.scroll(incoming)
            break

Program ar c’hoarierienn

from microbit import *
import radio
import music

anv = "melen"
sonerezh = music.BIRTHDAY

radio.on()

while True:
    display.show(Image.NO)
    while radio.receive() != "start":
        sleep(1)

    # Loc'het eo ar c'hoari
    display.show(Image.YES)
    message_sent = False
    while True:
        if button_a.is_pressed() and not message_sent:
            radio.send(anv)
            message_sent = True
        incoming = radio.receive()
        if not incoming:
            continue

        if incoming == anv:
            display.show(Image.HAPPY)
            music.play(sonerezh)
        else:
            display.show(Image.SAD)
        sleep(5000)
        break

Kod ar goulou LED

from microbit import *
import neopixel
from random import randint
import math

# Setup the Neopixel strip on pin0 with a length of 8 pixels
np = neopixel.NeoPixel(pin0, 30)

cycle = 0

while True:

    for pixel_id in range(0, len(np)):
        phase = math.pi * pixel_id / len(np)
        red = 255 * (math.sin(cycle + phase) + 1) / 2
        green = 255 * (math.sin(cycle*1.1 + phase) + 1) / 2
        blue = 255 * (math.sin(cycle*1.2 + phase) + 1) / 2

        # Assign the current LED a random red, green and blue value between 0 and 60
        np[pixel_id] = (int(red), int(green), int(blue))

        # Display the current pixel data on the Neopixel strip
        np.show()

    cycle += 0.2