tel0026
Différences
Ci-dessous, les différences entre deux révisions de la page.
Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
tel0026 [2017/04/20 10:03] – [Commandes AT] simon | tel0026 [2020/08/09 13:03] (Version actuelle) – modification externe 127.0.0.1 | ||
---|---|---|---|
Ligne 1: | Ligne 1: | ||
====== Bluetooth 2.0 Module V3 For Arduino ====== | ====== Bluetooth 2.0 Module V3 For Arduino ====== | ||
- | Le [[https:// | + | Le [[https:// |
===== Initialisation ===== | ===== Initialisation ===== | ||
- | Le [[https:// | + | Le [[https:// |
- | ==== Prérequis ==== | + | ==== Prérequis |
* Un [[https:// | * Un [[https:// | ||
* Un terminal série ( le logiciel arduino, minicom, ... ) | * Un terminal série ( le logiciel arduino, minicom, ... ) | ||
Ligne 20: | Ligne 20: | ||
Toutes les commandes se trouvent dans la [[http:// | Toutes les commandes se trouvent dans la [[http:// | ||
< | < | ||
- | * Input: | + | at |
- | * Return: | + | OK |
+ | |||
+ | at+init | ||
+ | | ||
- | * Input: | + | at+name? |
- | * Return: | + | +NAME: |
+ | OK | ||
- | * Input: | + | at+name=cequonveut |
- | * Return: | + | OK |
- | * Input: | + | at+role? //demander le rôle du module |
- | * Return:+name: cequonveut | + | +role:0 // 0 = slave , 1 = master |
+ | | ||
- | * Input: | + | at+role=0 //donner le rôle " |
- | * Return: +role: | + | OK |
- | * Input: at+role=0 | + | AT+PSWD? //Demander le mot de passe de " |
- | * Return: OK | + | +PSWD:1234 |
+ | | ||
- | * Input: | + | AT+ORGL // |
- | * Return: +PSWD: | + | OK |
- | * Input: | + | AT+UART? //Demander les paramètres de l'UART |
- | * Return: OK | + | +UART:38400,0,0 |
- | * Input: | + | AT+UART=38400, |
- | * +UART: | + | OK //Param1: baud rate (bits/s) 4800/ 9600/ 19200/ |
+ | //Param2: stop bit , 0- 1 bit/ 1- 2 bits | ||
+ | //Param3: parity bit, 0- None/ 1- Odd/ 2- Even | ||
- | * Input: | + | AT+RESET //reset du module |
- | * Return: OK | + | |
- | Param1: baud rate (bits/s) 4800/ 9600/ 19200/ 38400/ 57600/ 115200/ 230400/ 460800/ 912600/ 1382400 | + | |
- | | + | |
- | Param3: parity bit, 0- None/ 1- Odd/ 2- Even | + | |
- | * Input: | + | AT+ADDR? //demander l' |
- | * Return: OK | + | +ADDR:12d5: |
+ | | ||
- | * Input: | + | AT+INQM=1, |
- | * Return: +ADDR: | + | * OK |
- | * Input: | + | AT+IAC? |
- | * Return: | + | +IAC: |
+ | | ||
- | * Input: AT+SENM? | + | Input: AT+SENM? |
- | * Return: | + | +SENM: |
+ | | ||
</ | </ | ||
- | === Configuration basique de deux modules | + | === Erreurs possibles |
- | Module " | + | La page 16/23 du [[http:// |
< | < | ||
- | * AT+NAME=module-master | + | Error_code (hex) | Explanation |
- | | + | ------------------------------------------------------------------------ |
- | | + | 0 |
- | * +ADDR:98d3:32:20222e OK | + | 1 | The result is default value |
+ | 2 | PSKEY write error | ||
+ | 3 | Device | ||
+ | 4 | Device name is 0 byte | ||
+ | 5 | Bluetooth address: NAP is too long | ||
+ | 6 | Bluetooth address: UAP is too long | ||
+ | 7 | Bluetooth address: LAP is too long | ||
+ | 8 | PIO port mask length is 0 | ||
+ | 9 | Invalid PIO port | ||
+ | A | Device class is 0 byte | ||
+ | B | Device class is too long | ||
+ | C | Inquire Access Code length is 0 | ||
+ | D | Inquire Access Code is too long | ||
+ | E | Invalid Inquire Access Code | ||
+ | F | Pairing password is 0 | ||
+ | 10 | Pairing password is too long (more than 16 bytes) | ||
+ | 11 | Role of module is invalid | ||
+ | 12 | Baud rate is invalid | ||
+ | 13 | Stop bit is invalid | ||
+ | 14 | Parity bit is invalid | ||
+ | 15 | No device in the pairing list | ||
+ | 16 | SPP is not initialized | ||
+ | 17 | SPP is repeatedly initialized | ||
+ | 18 | Invalid inquiry mode | ||
+ | 19 | Inquiry timeout | ||
+ | 1A | Address is 0 | ||
+ | 1B | Invalid security mode | ||
+ | 1C | Invalid encryption mode | ||
</ | </ | ||
- | Module " | + | ===== Configuration de deux modules ===== |
+ | Pour faire la configuration de ces deux modules en même temps, j'ai utilisé | ||
+ | * deux ordinateurs avec le logiciel arduino (mais n' | ||
+ | * deux adaptateurs USB to TTL (exemples : [[https:// | ||
+ | * deux modules bluetooth (deux [[https:// | ||
+ | |||
+ | ==== Cosmo (slave) ==== | ||
< | < | ||
- | * AT+NAME=module-slave | + | at |
- | | + | OK |
- | | + | at+init |
- | | + | OK |
+ | at+state? | ||
+ | +STATE: | ||
+ | at+name=cosmo | ||
+ | | ||
+ | at+name? | ||
+ | +NAME: | ||
+ | at+role=0 | ||
+ | | ||
+ | at+role? | ||
+ | | ||
+ | at+addr? | ||
+ | | ||
+ | at+uart=38400, | ||
+ | | ||
+ | at+uart? | ||
+ | +UART: | ||
+ | at+iac? | ||
+ | +IAC: | ||
+ | at+cmode? | ||
+ | +CMOD:0 | ||
+ | at+inq | ||
+ | OK | ||
+ | at+bind? | ||
+ | +BIND: | ||
+ | at+bind=98d3, | ||
+ | OK | ||
+ | at+state? | ||
+ | +STATE: | ||
</ | </ | ||
+ | |||
+ | ==== Commande (master) ==== | ||
+ | < | ||
+ | at | ||
+ | OK | ||
+ | at+init | ||
+ | OK | ||
+ | at+state? | ||
+ | +STATE: | ||
+ | at+name=commande | ||
+ | OK | ||
+ | at+name? | ||
+ | +NAME: | ||
+ | at+role=1 | ||
+ | OK | ||
+ | at+role? | ||
+ | +ROLE:1 | ||
+ | at+addr? | ||
+ | +ADDR: | ||
+ | at+uart=38400, | ||
+ | OK | ||
+ | at+uart? | ||
+ | +UART: | ||
+ | at+iac? | ||
+ | +IAC:9e8b33 | ||
+ | at+cmode? | ||
+ | +CMOD:0 | ||
+ | at+inq | ||
+ | +INQ: | ||
+ | at+rname? | ||
+ | +RNAME: | ||
+ | at+bind? | ||
+ | +BIND: | ||
+ | at+bind=98d3, | ||
+ | OK | ||
+ | at+bind? | ||
+ | +BIND: | ||
+ | at+pair=98d3, | ||
+ | OK | ||
+ | at+state? | ||
+ | +STATE: | ||
+ | at+mrad? | ||
+ | +MRAD: | ||
+ | at+fsad=98d3, | ||
+ | OK //OK = oui | ||
+ | at+link=98d3, | ||
+ | OK | ||
+ | (réception de ce que le module slave envoit!) | ||
+ | </ | ||
+ | |||
+ | ==== Programmes Arduino ==== | ||
+ | Maintenant que nous avons configurés deux modules pour qu'ils se connectent ensemble, nous pouvons les utiliser chacun sur une Arduino et faire communiquer les deux Arduino ensemble. | ||
+ | |||
+ | * [[allumer une led via bluetooth]] | ||
+ | * [[Gestion de 3 leds via bluetooth]] | ||
+ | |||
===== Sources ===== | ===== Sources ===== | ||
+ | * [[https:// | ||
* [[http:// | * [[http:// | ||
+ | * [[https:// |
tel0026.txt · Dernière modification : 2020/08/09 13:03 de 127.0.0.1