MR25 play music

Le robot MR25 joue Star Wars :

Voici le programme en langage Python3 :

import MR25
import time

def star_wars():
melody = [
(440, 500), # A
(440, 500), # A
(440, 500), # A
(349, 350), # F
(523, 150), # C
(440, 500), # A
(349, 350), # F
(523, 150), # C
(440, 800), # A

(659, 500), # E
(659, 500), # E
(659, 500), # E
(698, 350), # F
(523, 150), # C
(415, 500), # G#
(349, 350), # F
(523, 150), # C
(440, 800), # A
]

for note, duree in melody:
MR25.buzzer(note, duree)
time.sleep(duree / 1000.0 + 0.05)

MR25.buzzerStop()

# Lecture de la mélodie
star_wars()

Le robot MR25 est disponible en boutique !

A bientôt,

Nicolas