Ligne 74 : |
Ligne 74 : |
| | | |
| == Quelle direction est-elle pointée? == | | == Quelle direction est-elle pointée? == |
− | '''1.''' Open '''Python 3''' from a terminal window as sudo by typing: | + | '''1.''' Ouvrez '''Python 3''' dans une fenêtre terminal en utilisant {{fname|sudo}} avec la commande suivante: |
| | | |
| <nowiki>sudo idle3 &</nowiki> | | <nowiki>sudo idle3 &</nowiki> |
| | | |
| | | |
− | '''2.''' Select {{fname|File > New Window}} (''Fichier > Nouvelle fenêtre'') and enter the following code: | + | '''2.''' Selectionnez le menu {{fname|File > New Window}} (''Fichier > Nouvelle fenêtre'') et entrez le code suivant: |
| | | |
| <nowiki>from sense_hat import SenseHat | | <nowiki>from sense_hat import SenseHat |
Ligne 91 : |
Ligne 91 : |
| print("pitch %s roll %s yaw %s" % (pitch, roll, yaw))</nowiki> | | print("pitch %s roll %s yaw %s" % (pitch, roll, yaw))</nowiki> |
| | | |
− | '''3.''' Select {{fname|File > Save}} (''Fichier > Sauver sous'') and choose a file name for your program. | + | '''3.''' Sélectionnez le menu {{fname|File > Save}} (''Fichier > Sauver sous'') et choisissez une nom pour votre programme. |
| | | |
− | '''4.''' Select {{fname|Run > Run module}} (''Executer > Exécuter module''). | + | '''4.''' Sélectionnez {{fname|Run > Run module}} (''Executer > Exécuter module''). |
| | | |
− | '''5.''' If you see the error {{fname|IMU Init Failed, please run as root / use sudo}} on the last line in red, it means you haven't followed the instructions above. Close everything and go back to step 1. | + | '''5.''' Si vous voyez l'erreur {{fname|IMU Init Failed, please run as root / use sudo}} sur la dernière ligne en rouge, cela signifie que vous n'avez pas suivit les instructions ci-dessus. Fermez tout et reprenez à l'étape 1. |
| | | |
| Le message "IMU Init Failed" signifie "''Echec d'initialisation de l'IMU''". | | Le message "IMU Init Failed" signifie "''Echec d'initialisation de l'IMU''". |
| | | |
− | '''6.''' You should now see something like this: | + | '''6.''' Vous devirez maintenant un résultat semblable à celui-ci: |
| | | |
| <nowiki>IMU Init Succeeded | | <nowiki>IMU Init Succeeded |
Ligne 106 : |
Ligne 106 : |
| La première ligne "IMU Init Succeeded" signifie que l'IMU à été initialisé avec succès. | | La première ligne "IMU Init Succeeded" signifie que l'IMU à été initialisé avec succès. |
| | | |
− | '''7.''' We don't need all the numbers after the decimal point so let's round them off. Just before the print("pitch %s roll %s yaw %s" % (pitch, roll, yaw)) line, add these lines below:
| + | Vous noterez également les 3 valeurs "pitch", "roll" et "yaw" dont nous avons expliqué la signification plus haut dans l'article. |
| | | |
− | <nowiki>pitch = round(pitch, 1) | + | '''7.''' Nous n'avons pas besoin de toutes ces décimales derrière le point. Nous allons faire le nécessaire pour les arrondir juste avant l'instruction {{fname|print("pitch %s roll %s yaw %s" % (pitch, roll, yaw))}} avec les lignes suivantes: |
| + | |
| + | <nowiki>pitch = round(pitch, 1) # ne garder qu'un seul chiffre après le point décimal. |
| roll = round(roll, 1) | | roll = round(roll, 1) |
| yaw = round(yaw, 1)</nowiki> | | yaw = round(yaw, 1)</nowiki> |