BBC MICRO:BIT
Lesson 1
Sequencing
Source : http://physicalcomputing.co.uk
What is it?
Le micro: bit est un ordinateur de poche entièrement programmable. Il est 70 fois
plus petit et 18 fois plus rapide que les ordinateurs BBC Micro utilisés dans les
écoles dans les années 1980.
Ce petit appareil possède de nombreuses fonctionnalités, telles que 25 voyants rouges
pouvant faire clignoter des messages. Il y a deux boutons programmables qui peuvent
être utilisés pour contrôler les jeux ou mettre en pause et ignorer les chansons d'une liste
de lecture. Le BBC micro: bit peut même détecter les mouvements et vous indiquer la
direction dans laquelle vous vous dirigez.
Source : http://physicalcomputing.co.uk
J-Louis HUG
Micro:bit BBC
Matrice de 25 Leds rouge
Bluetooth Radio
Bouton poussoir A
Bouton poussoir B
Capteur de lumière
25 connecteurs externes
Carte microbit BBC (recto)
J-Louis HUG
Micro:bit BBC
Matrice de 25 Leds rouge Connecteur micro usb
Radio
Bluetooth
Bouton poussoir A Bouton poussoir B
Boussole Capteur de lumière
Accéléromè
tre
Capteur de
25 connecteurs externes température
Carte microbit BBC (verso)
Algorithms
Un algorithme est un ensemble d'instructions qui s’enchaînent pour résoudre un
problème. Voici un algorithme simple pour faire du pain grillé:
Start
Slice the bread
(tranche le pain)
Toast the bread
(toast le pain)
Butter the toast
(beurre le pain)
Spread the jam
(Etale la confiture)
Cet algorithme se présente sous la forme d’un organigramme
End
Source : http://physicalcomputing.co.uk
Sequencing
Le type d'algorithme le plus simple utilise le séquençage, un ensemble
d'instructions exécutées les unes après les autres.
Start Cet algorithme (sous forme d’organigramme) affichera le
texte “Computer”, “Science”, “Rocks” sur le micro: bit.
Display
“Computer”
Nous pouvons transformer un algorithme en programme
informatique en utilisant un langage de programmation tel
Display “Science” que Python.
Display “Rocks” Python est un langage de programmation commun qui est
beaucoup utilisé pour le développement Web.
End
Source : http://physicalcomputing.co.uk
Activity 1.1
Corrige le code Python pour qu’il corresponde à l'organigramme.
Start
Display
“Computer”
Display “Science”
Display “Rocks”
End
Source : http://physicalcomputing.co.uk
Mu Editor
Vous allez utiliser l’éditeur Mu pour programmer votre micro: bit.
Clique sur ce bouton pour charger votre
programme dans micro:bit
Vous avez toujours besoin de cette ligne au
début de chaque programme.
Ecrire votre code ici.
Source : http://physicalcomputing.co.uk
Displaying Text
Vous pouvez afficher du texte sur le micro: bit à l’aide de la commande
display.scroll
Ce code affichera les textes «Hello» et «World» sur le micro: bit. Essayez le
code pour voir le résultat.
Source : http://physicalcomputing.co.uk
Activity 1.2
Créez un programme qui affichera le texte «Computer» «Science» «Rocks» sur
le micro:bit.
Utilisez cet exemple de code
comme point de départ :
Placez une capture d'écran de votre code.
Source : http://physicalcomputing.co.uk
Images
MicroPython (la version de Python utilisée par micro:bit) est livré avec de
nombreuses images intégrées.
Essayez de créer un nouveau programme avec le code ci-dessous et chargez-le
sur votre micro:bit.
Source : http://physicalcomputing.co.uk
Built In Images
Voici une liste des images intégrées dans Micro Python :
Image.HEART
Image.TRIANGLE_LEFT Image.TARGET
Image.HEART_SMALL
Image.CHESSBOARD Image.TSHIRT
Image.HAPPY
Image.DIAMOND Image.ROLLERSKATE
Image.SMILE
Image.DIAMOND_SMALL Image.DUCK
Image.SAD
Image.SQUARE Image.HOUSE
Image.CONFUSED
Image.SQUARE_SMALL Image.TORTOISE
Image.ANGRY
Image.RABBIT Image.BUTTERFLY
Image.ASLEEP
Image.COW Image.STICKFIGURE
Image.SURPRISED
Image.MUSIC_CROTCHET Image.GHOST
Image.SILLY
Image.MUSIC_QUAVER Image.SWORD
Image.FABULOUS
Image.MUSIC_QUAVERS Image.GIRAFFE
Image.MEH
Image.PITCHFORK Image.SKULL
Image.YES
Image.XMAS Image.UMBRELLA
Image.NO
Image.PACMAN Image.SNAKE
Image.TRIANGLE
Image.CLOCK12 # clock at 12 o' clock
Image.ARROW_N
... # arrows pointing N, NE, E, SE, S, SW, W, NW (microbit.Image.ARROW_direction)
Source : http://physicalcomputing.co.uk
Activity 1.3
Créez un programme pour afficher une image intégrée de votre choix.
Utilisez cet exemple de code
pour vous aider :
Placez une capture d'écran de votre code
ici.
Source : http://physicalcomputing.co.uk
Delays
Vous pouvez créer un délai entre les lignes de code en Python.
Le code ci-dessous montrera un visage heureux pendant 1 sec. avant de passer à
un visage triste. Essayez pour voir le résultat.
Source : http://physicalcomputing.co.uk
Activity 1.4
Créez une animation en utilisant les différentes images intégrées. Utilisez la
fonction « sleep » pour créer une pause entre les images.
Utilisez cet exemple de code
comme point de départ :
Placez une capture d'écran de votre code ici.
Source : http://physicalcomputing.co.uk