Différences entre versions de « Bluefruit-LE-Shield-HIDKeyboard »

De MCHobby - Wiki
Sauter à la navigation Sauter à la recherche
 
(16 versions intermédiaires par le même utilisateur non affichées)
Ligne 1 : Ligne 1 :
 
{{Bluefruit-LE-Shield-NAV}}
 
{{Bluefruit-LE-Shield-NAV}}
 
{{traduction}}
 
  
 
== Le croquis HIDKeyboard ==
 
== Le croquis HIDKeyboard ==
The '''HIDKeyboard''' example shows you how you can use the built-in HID keyboard AT commands to send keyboard data to any BLE-enabled Android or iOS phone, or other device that supports BLE HID peripherals.
+
L'exemple '''HIDKeyboard''' vous montre comment utiliser les commandes AT pour la fonctionnalité HID keyboard afin d'envoyer des données clavier vers n'importe quel périphérique Android ou iOS (supportant BLE). Cela fonctionne également avec les autres périphériques supportant la spécification "BLE HID peripherals".
  
 
== Ouvrir le croquis ==
 
== Ouvrir le croquis ==
To open the ATCommand sketch, click on the '''File > Examples > Adafruit_BluefruitLE_nRF51''' folder in the Arduino IDE and select '''hidkeyboard''':
+
Pour ouvrir le croquis ATCommand, cliquez sur le menu '''Fichiers > Exemples > Adafruit_BluefruitLE_nRF51''' dans Arduino IDE puis sélectionnez '''hidkeyboard''':
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-00.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-00.png}}
  
This will open up a new instance of the example in the IDE, as shown below:
+
Cela ouvrira l'exemple dans l'environnement de développement, comme visible ci-dessous:
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-01.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-01.png}}
  
 
== Configuration ==
 
== Configuration ==
Check the '''Configuration!''' page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI
+
Vérifiez la page '''Configuration''' présenter plus tôt dans le tutoriel! Il est important de configurer le croquis pour utiliser soit l'UART Logiciel/Matériel, soit le bus SPI Logiciel/Matériel correspondant à votre plateforme. Par défaut, le croquis utilise le bus SPI matériel
  
If using software or hardware Serial UART:
+
Si vous utilisez le port série/UART logiciel ou matériel:
* This tutorial does not need to use the MODE pin, '''make sure you have the mode switch in CMD mode''' if you do not configure & connect a MODE pin
+
* Ce tutoriel ne requière pas l'utilisation de la broche MODE, '''assurez-vous d'avoir l'interrupteur en position CMD''' si vous ne configurer pas (et ne connectez pas) la broche MODE.
* Don't forget to also '''connect the CTS pin on the Bluefruit to ground if you are not using it!''' (The Flora has this already done)
+
* N'oubliez pas de '''connecter la broche CTS sur la masse/GND du Bluefruit si vous n'utilisez pas le signal CTS!''' (Le Flora l'a déjà branché à la masse)
  
 
== Exécuter le croquis ==
 
== Exécuter le croquis ==
Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via '''Tools > Serial Monitor''', and make sure that the baud rate in the lower right-hand corner is set to '''115200''':
+
Une fois le croquis téléversé sur votre carte Arduino, vous pouvez ouvrir le moniteur série via le menu '''Outils > Moniteur série'''. Assurez-vous que le débit (Baud rate) soit configuré sur '''115200''' bauds (en bas à droite):
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-10.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-10.png}}
 
== Utiliser Bluefruit LE Connect en mode contrôleur ==
 
Once the sketch is running you can open Adafruit's Bluefruit LE Connect application (available for [https://play.google.com/store/apps/details?id=com.adafruit.bluefruit.le.connect Android] or [https://itunes.apple.com/app/adafruit-bluefruit-le-connect/id830125974?mt=8 iOS]) and use the '''Controller''' application to interact with the sketch.  (If you're new to Bluefruit LE Connect, have a look at our dedicated [https://learn.adafruit.com/bluefruit-le-connect-for-ios/settings Bluefruit LE Connect] learning guide (''Adafruit, anglais'').)
 
 
On the welcome screen, select the Adafruit Bluefruit LE device from the list of BLE devices in range:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-20.jpg}}
 
 
Then from the activity list select Controller:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-21.jpg}}
 
 
This will bring up a list of data points you can send from your phone or tablet to your Bluefruit LE module, by enabling or disabling the appropriate sensor(s).
 
 
== Streamer les données de senseur ==
 
You can take Quaternion (absolute orientation), Accelerometer, Gyroscope, Magnetometer or GPS Location data from your phone and send it directly to your Arduino from the Controller activity.
 
 
By enabling the '''Accelerometer''' field, for example, you should see accelerometer data update in the app:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-30.jpg}}
 
 
The data is parsed in the example sketch and output to the Serial Monitor as follows:
 
 
<nowiki>Accel 0.20 -0.51 -0.76
 
Accel 0.22 -0.50 -0.83
 
Accel 0.25 -0.51 -0.83
 
Accel 0.21 -0.47 -0.76
 
Accel 0.27 -0.48 -0.82</nowiki>
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-31.png}}
 
 
Note that even though we only print 2 decimal points, the values are received from the App as a full 4-byte floating point.
 
 
== Le pavé de commande ==
 
You can also use the ''Control Pad Module'' to capture button presses and releases by selecting the appropriate menu item:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-40.jpg}}
 
 
This will bring up the Control Pad panel, shown below:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-41.png}}
 
 
Button presses and releases will all be logged to the Serial Monitor with the ID of the button used:
 
 
<nowiki>Button 8 pressed
 
Button 8 released
 
Button 3 pressed
 
Button 3 released</nowiki>
 
 
== Sélection de couleur ==
 
You can also send RGB color data via the '''Color Picker module''', which presents the following color selection dialogue:
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-50.jpg}}
 
 
This will give you Hexadecimal color data in the following format:
 
 
<nowiki>RGB #A42FFF</nowiki>
 
 
{{#Widget:Iframe
 
|url=https://youtu.be/Kym6crZF1Pg
 
|width=560
 
|height=315
 
|border=0
 
}}
 
 
You can combine the color picker and controller sample sketches to make color-configurable animations triggered by buttons in the mobile app-- very handy for wearables! Download this combined sample code (configured for Feather but easy to adapt to FLORA, BLE Micro, etc.) to get started:
 
 
{{download-box|feather_bluefruit_neopixel_animation_controller.zip|https://learn.adafruit.com/system/assets/assets/000/029/260/original/feather_bluefruit_neopixel_animation_controller.zip?1450791688}}
 
 
== Configuration ==
 
Check the '''Configuration!''' page earlier to set up the sketch for Software/Hardware UART or Software/Hardware SPI. The default is hardware SPI
 
 
If using software or hardware Serial UART:
 
* This tutorial does not need to use the MODE pin, '''make sure you have the mode switch in CMD mode''' if you do not configure & connect a MODE pin
 
* Don't forget to also '''connect the CTS pin on the Bluefruit to ground if you are not using it!''' (The Flora has this already done)
 
 
== Exécuter le croquis ==
 
{{traduction}}
 
Once you upload the sketch to your board (via the arrow-shaped upload icon), and the upload process has finished, open up the Serial Monitor via '''Tools > Serial Monitor''', and make sure that the baud rate in the lower right-hand corner is set to '''115200''':
 
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-10.png}}
 
 
To send keyboard data, type anything into the textbox at the top of the Serial Monitor and click the Send button.
 
  
 
== Lier le clavier HID ==
 
== Lier le clavier HID ==
Before you can use the HID keyboard, you will need to 'bond' it to your phone or PC. The bonding process establishes a permanent connection between the two devices, meaning that as soon as your phone or PC sees the Bluefruit LE module again it will automatically connect.
+
Avant de pouvoir utiliser le clavier "HID keyboard", il sera nécessaire de le lié/l'appairer avec votre téléphone ou PC. Le mécanisme d'appairage (''bonding'' en anglais) permet d'établir une connexion permanente entre les deux périphérique. Cela signifie que dès que votre téléphone ou PC redétecte ce module Bluefruit LE module bien précis alors il est connecté automatiquement.
  
The exact procedures for bonding the keyboard will varying from one platform to another.
+
La procédure exacte à utilisé pour faire l'appairage varie d'une plateforme à l'autre.
  
{{ambox-stop|text= When you no longer need a bond, or wish to bond the Bluefruit LE module to another device, be sure to delete the bonding information on the phone or PC, otherwise you may not be able to connect on a new device! }}
+
{{ambox-stop|text=Lorsque vous n'avez plus besoin de l'appairage d'un module, ou si vous désirez re-appairer le périphérique Bluefruit LE sur un autre appareil, alors il faut effacer les informations d'appairage stocké sur le téléphone ou ordinateu... sinon il ne sera pas possible de le connecter avec un nouveau périphérique! }}
  
== Android ==
+
=== Android ===
To bond the keyboard on a Bluetooth Low Energy enabled Android device, go to the '''Settings''' application and click the '''Bluetooth''' icon.
+
Pour lier le clavier (''keyboard'') sur un périphérique Android compatible BLE, rendez-vous dans l'application '''Paramètres''' (''Settings'' en anglais) et cliquez sur l'icon '''Bluetooth'''.
  
{{ambox|text= These screenshots are based on Android 5.0 running on a Nexus 7 2013. The exact appearance may vary depending on your device and OS version.}}
+
{{ambox|text=Ces captures d'écran son basées sur un Android 5.0 fonctionnant sur un Nexus 7 2013. L'apparence peut varier d'un périphérique à l'autre et d'une version de l'OS à l'autre.}}
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-20.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-20.jpg}}
  
Inside the Bluetooth setting panel you should see the Bluefruit LE module advertising itself as '''Bluefruit Keyboard''' under the 'Available devices' list:
+
Dans le volet de configuration Bluetooth vous pouvez voir la liste des périphériques disponibles. Vous devriez y voir le module Bluefruit LE s’annonçant sous le nom '''Bluefruit Keyboard''':
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-21.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-21.jpg}}
  
Tapping the device will start the bonding process, which should end with the Bluefruit Keyboard device being moved to a new 'Paired devices' list with 'Connected' written underneath the device name:
+
Sélectionner le périphérique permet de démarrer le processus d'appairage. Processus qui se termine par le placement du périphérique "Bluefruit Keyboard" dans la liste des produits appairés (''Paired devices'' en anglais). Le libellé sous le périphérique devrait indiqué 'Connecté' (ou ''Connected'' en anglais):
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-22.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-22.jpg}}
  
To delete the bonding information, click the gear icon to the right of the device name and the click the Forget button:
+
Pour effacer les information d'appairage, il faut cliquer sur l'icon en forme de roue dentée en regard du périphérique puis cliquer sur le bouton "Abandonner/Relâcher" (''Forget'' en anglais):
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-23.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-23.jpg}}
  
== iOS ==
+
=== iOS ===
To bond the keyboard on an iOS device, go to the '''Settings''' application on your phone, and click the '''Bluetooth''' menu item.
+
Pour lier le "clavier" sur un périphérique iOS, rendez-vous dans l'application '''Configuration''' (''''Settings'' en anglais) de votre téléphone et cliquer sur le point de menu '''Bluetooth'''.
  
The keyboard should appear under the '''OTHER DEVICES''' list:
+
Le clavier devrait apparaître sous la liste '''AUTRES PERIPHERIQUES''' (''OTHER DEVICES'' en anglais):
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-30.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-30.jpg}}
  
Once the bonding process is complete the device will be moved to the '''MY DEVICES''' category, and you can start to use the Bluefruit LE module as a keyboard:
+
Une fois le processus d'appairage terminé, le périphérique est déplacé dans la catégorie '''MES PERIPHERIQUES''' (''MY DEVICES'' en anglais). Il sera alors possible de commencer à utiliser le modul e Bluefruit LE comme un clavier:
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-31.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-31.jpg}}
  
To unbond the device, click the 'info' icon and then select the '''Forget this Device''' option in the menu:
+
Pour abandonner l'appairage, cliquez sur l'icone 'info' et sélectionnez ensuite l'option '''Abandonner ce périphérique''' (''Forget this Device'' en anglais).
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-32.jpg}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-32.jpg}}
  
== OS X ==
+
=== OS X ===
To bond the keyboard on an OS X device, go to the '''Bluetooth Preferences''' window and click the '''Pair''' button beside the '''Bluefruit Keyboard''' device generated by this example sketch:
+
Pour appairer le clavier sur un périphérique OS X device, rendez vous dans la fenêtre des '''Préférence Bluetooth''' et cliquez sur le bouton '''Appairer''' (ou ''Pair'') en face du périphérique '''Bluefruit Keyboard''' (tel qu'il est nommé dans le croquis d'exemple):
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-40.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-40.png}}
  
To unbond the device once it has been paired, click the small 'x' icon beside '''Bluefruit Keyboard''':
+
Une fois appairé, il est possible d'abandonner l'appairage en cliquant sur l'icone 'x' situe à côté du périphérique '''Bluefruit Keyboard''':
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-41.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-41.png}}
  
... and then click the Remove button when the confirmation dialogue box pops up:
+
... et cliquer ensuite sur le bouton '''Enlever''' (''Remove'' en anglais) lorsque la fenêtre de confirmation apparaît:
  
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-42.png}}
 
{{ADFImage|Bluefruit-LE-Shield-HIDKeyboard-42.png}}
  
 
{{Bluefruit-LE-Shield-TRAILER}}
 
{{Bluefruit-LE-Shield-TRAILER}}

Version actuelle datée du 26 mai 2017 à 14:55


MCHobby investit du temps et de l'argent dans la réalisation de traduction et/ou documentation. C'est un travail long et fastidieux réalisé dans l'esprit Open-Source... donc gratuit et librement accessible.
SI vous aimez nos traductions et documentations ALORS aidez nous à en produire plus en achetant vos produits chez MCHobby.

Le croquis HIDKeyboard

L'exemple HIDKeyboard vous montre comment utiliser les commandes AT pour la fonctionnalité HID keyboard afin d'envoyer des données clavier vers n'importe quel périphérique Android ou iOS (supportant BLE). Cela fonctionne également avec les autres périphériques supportant la spécification "BLE HID peripherals".

Ouvrir le croquis

Pour ouvrir le croquis ATCommand, cliquez sur le menu Fichiers > Exemples > Adafruit_BluefruitLE_nRF51 dans Arduino IDE puis sélectionnez hidkeyboard:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Cela ouvrira l'exemple dans l'environnement de développement, comme visible ci-dessous:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Configuration

Vérifiez la page Configuration présenter plus tôt dans le tutoriel! Il est important de configurer le croquis pour utiliser soit l'UART Logiciel/Matériel, soit le bus SPI Logiciel/Matériel correspondant à votre plateforme. Par défaut, le croquis utilise le bus SPI matériel

Si vous utilisez le port série/UART logiciel ou matériel:

  • Ce tutoriel ne requière pas l'utilisation de la broche MODE, assurez-vous d'avoir l'interrupteur en position CMD si vous ne configurer pas (et ne connectez pas) la broche MODE.
  • N'oubliez pas de connecter la broche CTS sur la masse/GND du Bluefruit si vous n'utilisez pas le signal CTS! (Le Flora l'a déjà branché à la masse)

Exécuter le croquis

Une fois le croquis téléversé sur votre carte Arduino, vous pouvez ouvrir le moniteur série via le menu Outils > Moniteur série. Assurez-vous que le débit (Baud rate) soit configuré sur 115200 bauds (en bas à droite):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Lier le clavier HID

Avant de pouvoir utiliser le clavier "HID keyboard", il sera nécessaire de le lié/l'appairer avec votre téléphone ou PC. Le mécanisme d'appairage (bonding en anglais) permet d'établir une connexion permanente entre les deux périphérique. Cela signifie que dès que votre téléphone ou PC redétecte ce module Bluefruit LE module bien précis alors il est connecté automatiquement.

La procédure exacte à utilisé pour faire l'appairage varie d'une plateforme à l'autre.

Android

Pour lier le clavier (keyboard) sur un périphérique Android compatible BLE, rendez-vous dans l'application Paramètres (Settings en anglais) et cliquez sur l'icon Bluetooth.

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Dans le volet de configuration Bluetooth vous pouvez voir la liste des périphériques disponibles. Vous devriez y voir le module Bluefruit LE s’annonçant sous le nom Bluefruit Keyboard:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Sélectionner le périphérique permet de démarrer le processus d'appairage. Processus qui se termine par le placement du périphérique "Bluefruit Keyboard" dans la liste des produits appairés (Paired devices en anglais). Le libellé sous le périphérique devrait indiqué 'Connecté' (ou Connected en anglais):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Pour effacer les information d'appairage, il faut cliquer sur l'icon en forme de roue dentée en regard du périphérique puis cliquer sur le bouton "Abandonner/Relâcher" (Forget en anglais):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

iOS

Pour lier le "clavier" sur un périphérique iOS, rendez-vous dans l'application Configuration' ('Settings en anglais) de votre téléphone et cliquer sur le point de menu Bluetooth.

Le clavier devrait apparaître sous la liste AUTRES PERIPHERIQUES (OTHER DEVICES en anglais):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Une fois le processus d'appairage terminé, le périphérique est déplacé dans la catégorie MES PERIPHERIQUES (MY DEVICES en anglais). Il sera alors possible de commencer à utiliser le modul e Bluefruit LE comme un clavier:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Pour abandonner l'appairage, cliquez sur l'icone 'info' et sélectionnez ensuite l'option Abandonner ce périphérique (Forget this Device en anglais).

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

OS X

Pour appairer le clavier sur un périphérique OS X device, rendez vous dans la fenêtre des Préférence Bluetooth et cliquez sur le bouton Appairer (ou Pair) en face du périphérique Bluefruit Keyboard (tel qu'il est nommé dans le croquis d'exemple):

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

Une fois appairé, il est possible d'abandonner l'appairage en cliquant sur l'icone 'x' situe à côté du périphérique Bluefruit Keyboard:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com

... et cliquer ensuite sur le bouton Enlever (Remove en anglais) lorsque la fenêtre de confirmation apparaît:

{{{2}}}
Crédit: AdaFruit Industries www.adafruit.com


Basé sur "Bluefruit LE Shield" d'Adafruit Industries, écrit par Kevin Townsend - Traduit en Français par shop.mchobby.be CC-BY-SA pour la traduction
Toute copie doit contenir ce crédit, lien vers cette page et la section "crédit de traduction".

Based on "Bluefruit LE Shield" from Adafruit Industries, written by Kevin Townsend - Translated to French by shop.mchobby.be CC-BY-SA for the translation
Copies must includes this credit, link to this page and the section "crédit de traduction" (translation credit).

Traduit avec l'autorisation d'AdaFruit Industries - Translated with the permission from Adafruit Industries - www.adafruit.com