Repositorios para el proyecto de hidroponia

Committer:
iwhalk
Date:
Fri Jun 10 00:09:18 2022 -0500
Revision:
1:7b3ea5d5e074
Parent:
0:19f9867f1730
prueba

Who changed what in which revision?

UserRevisionLine numberNew contents of line
iwhalk 0:19f9867f1730 1 /* #############################################################################
iwhalk 0:19f9867f1730 2 ** Archivo : main.c
iwhalk 0:19f9867f1730 3 ** Proyecto : STM32F103C8_Bluetooth_Terminal
iwhalk 0:19f9867f1730 4 ** Procesador : STM32F103C8T6
iwhalk 0:19f9867f1730 5 ** Plataforma : Blue Pill
iwhalk 0:19f9867f1730 6 ** Herramienta : Mbed
iwhalk 0:19f9867f1730 7 ** Compilador : Mbed Online C Compiler
iwhalk 0:19f9867f1730 8 ** Version : Mbed-OS 5.15.0
iwhalk 0:19f9867f1730 9 ** Fecha/Hora : 18-12-2019, 11:48, # CodeGen: 0
iwhalk 0:19f9867f1730 10 ** Descripción :
iwhalk 0:19f9867f1730 11 ** Este proyecto utiliza la Terminal Serial para interactuar con la
iwhalk 0:19f9867f1730 12 ** Conexión Serial del Bluetooth como Terminal Serial
iwhalk 0:19f9867f1730 13 ** This module contains user's application code.
iwhalk 0:19f9867f1730 14 ** Componentes : GPIO, Timer, etc .
iwhalk 0:19f9867f1730 15 ** Configuraciones : Includes, Stacks y Drivers externos
iwhalk 0:19f9867f1730 16 ** Autores :
iwhalk 0:19f9867f1730 17 ** ATEAM Development Group:
iwhalk 0:19f9867f1730 18 ** - Antulio Morgado Valle
iwhalk 0:19f9867f1730 19 **
iwhalk 0:19f9867f1730 20 ** Versión : Beta
iwhalk 0:19f9867f1730 21 ** Revisión : A
iwhalk 0:19f9867f1730 22 ** Release : 0
iwhalk 0:19f9867f1730 23 ** Bugs & Fixes :
iwhalk 0:19f9867f1730 24 ** Date : 20/10/2019
iwhalk 0:19f9867f1730 25 ** First Release
iwhalk 0:19f9867f1730 26 **
iwhalk 0:19f9867f1730 27 **
iwhalk 0:19f9867f1730 28 **
iwhalk 0:19f9867f1730 29 ** ###########################################################################*/
iwhalk 0:19f9867f1730 30 /*
iwhalk 0:19f9867f1730 31 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
iwhalk 0:19f9867f1730 32 : I N C L U D E S
iwhalk 0:19f9867f1730 33 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
iwhalk 0:19f9867f1730 34 */
iwhalk 0:19f9867f1730 35 #include "stm32f103c8t6.h"
iwhalk 0:19f9867f1730 36 #include "mbed.h"
iwhalk 0:19f9867f1730 37 #include "Serial.h"
iwhalk 0:19f9867f1730 38 //#include "AnalogIn.h"
iwhalk 0:19f9867f1730 39 //#include "Led_RGB.h"
iwhalk 0:19f9867f1730 40 //#include <stdio.h>
iwhalk 0:19f9867f1730 41
iwhalk 0:19f9867f1730 42 /*
iwhalk 0:19f9867f1730 43 :...............................................................................
iwhalk 0:19f9867f1730 44 : D E F I N I C I O N E S
iwhalk 0:19f9867f1730 45 :...............................................................................
iwhalk 0:19f9867f1730 46 */
iwhalk 0:19f9867f1730 47 #define LED_ON 0 // Estado para el Led Encendido
iwhalk 0:19f9867f1730 48 #define LED_OFF 1 // Estado para el Led Apagado
iwhalk 0:19f9867f1730 49 #define BUZZ_ON 1 // Estado para Buzzer Encendido
iwhalk 0:19f9867f1730 50 #define BUZZ_OFF 0 // Estado para Buzzer Apagado
iwhalk 0:19f9867f1730 51 #define FALSE 0 // Estado FALSO
iwhalk 0:19f9867f1730 52 #define TRUE 1 // Estado VERDADERO
iwhalk 0:19f9867f1730 53 #define LOW 0 // Estado para Nivel "Bajo"
iwhalk 0:19f9867f1730 54 #define HIGH 1 // Estado para Nivel "Alto"
iwhalk 0:19f9867f1730 55 #define ON 0 // Estado para boton presionado
iwhalk 0:19f9867f1730 56 #define OFF 1 // Estado para boton sin presionar
iwhalk 0:19f9867f1730 57 #define HOLD 2 // Estado para boton mantenido
iwhalk 0:19f9867f1730 58 #define RELEASE 3 // Estado para boton liberado
iwhalk 0:19f9867f1730 59 #define TICKER_RATE 1000 // Periodo de Interrupción (us)
iwhalk 0:19f9867f1730 60 #define BAUD_RATE 115200 // Velocidad de Transmisión (Bauds))
iwhalk 0:19f9867f1730 61 // Velocidades Permitidas:
iwhalk 0:19f9867f1730 62 // 300, 600, 1200, 2400, 4800, 9600,
iwhalk 0:19f9867f1730 63 // 14400, 19600, 28800, 38400, 57600
iwhalk 0:19f9867f1730 64 // 115200, 230400
iwhalk 0:19f9867f1730 65 #define BT_App_Type 0 // App en el Celular: 0=Estandar 1=Emulador
iwhalk 0:19f9867f1730 66 #if BT_App_Type == 0
iwhalk 0:19f9867f1730 67 #define BT_BAUD_RATE 38400 // Velocidad Estandar Bluetoothclado (default)
iwhalk 0:19f9867f1730 68 #endif
iwhalk 0:19f9867f1730 69 #if BT_App_Type == 1
iwhalk 0:19f9867f1730 70 #define BT_BAUD_RATE 9600 // Velocidad de Emulación Terminal Serial
iwhalk 0:19f9867f1730 71 #endif
iwhalk 0:19f9867f1730 72
iwhalk 0:19f9867f1730 73 /*
iwhalk 0:19f9867f1730 74 *===============================================================================
iwhalk 0:19f9867f1730 75 *
iwhalk 0:19f9867f1730 76 * C O N F I G U R A C I O N D E P U E R T O S
iwhalk 0:19f9867f1730 77 *
iwhalk 0:19f9867f1730 78 *===============================================================================
iwhalk 0:19f9867f1730 79 */
iwhalk 0:19f9867f1730 80 Ticker TimerInt; // Inicializa la Interrupción por Timer
iwhalk 0:19f9867f1730 81 DigitalOut led_monitor(LED1); // Inicializa el LED Monitor (Interno)
iwhalk 0:19f9867f1730 82 DigitalOut led_testigo(PB_12); // Inicializa el LED Testigo (Externo)
iwhalk 0:19f9867f1730 83 DigitalOut Led_Verde(PB_13); // Inicializa el PWM2 (PA6_TIM1_CH1N) Led VERDE
iwhalk 0:19f9867f1730 84 DigitalOut Led_Rojo(PB_14); // Inicializa el PWM3 (PA7_TIM1_CH2N) Led ROJO
iwhalk 0:19f9867f1730 85 DigitalOut Led_Azul(PB_15); // Inicializa el PWM1 (PB0_TIM1_CH3N) Led AZUL
iwhalk 0:19f9867f1730 86 DigitalOut key_pin(PB_5,HIGH); // Inicializa el KEY pin o STATE pin (AT Commnands)
iwhalk 0:19f9867f1730 87 PwmOut pwm1(PA_7); // Inicializa el PWM para el LED Externo
iwhalk 0:19f9867f1730 88 PwmOut buzzer(PB_0); // Inicializa el PWM para el Buzzer Externo
iwhalk 0:19f9867f1730 89 AnalogIn Sensor1(PA_0); // Inicializa Canal Analógico para Potenciometro 1
iwhalk 0:19f9867f1730 90 Serial terminal(PA_2, PA_3); // Inicializa la Comunicación Serial UART_2 a la PC (Tx, Rx)
iwhalk 0:19f9867f1730 91 Serial bluetooth(PB_10, PB_11);// Inicializa la Comunicación Serial UART_3 sobre Bluetooth (Tx, Rx)
iwhalk 0:19f9867f1730 92 //Serial bluetooth(PA_9, PA_10); // Inicializa la Comunicación Serial UART1 sobre Bluetooth (Tx, Rx)
iwhalk 0:19f9867f1730 93 //Serial bluetooth(PB_6, PB_7); // Inicializa la Comunicación Serial UART1 sobre Bluetooth (Tx, Rx)
iwhalk 0:19f9867f1730 94 /*
iwhalk 0:19f9867f1730 95 #===============================================================================
iwhalk 0:19f9867f1730 96 |
iwhalk 0:19f9867f1730 97 | A R E A D E D A T O S
iwhalk 0:19f9867f1730 98 |
iwhalk 0:19f9867f1730 99 #===============================================================================
iwhalk 0:19f9867f1730 100 */
iwhalk 0:19f9867f1730 101 /*
iwhalk 0:19f9867f1730 102 +-------------------------------------------------------------------------------
iwhalk 0:19f9867f1730 103 | Variables Globales de Usuario
iwhalk 0:19f9867f1730 104 +-------------------------------------------------------------------------------
iwhalk 0:19f9867f1730 105 */
iwhalk 0:19f9867f1730 106 uint16_t Rate=TICKER_RATE/2; // Velocidad de barrido (500us = 0.5ms)
iwhalk 0:19f9867f1730 107 uint16_t counter=250; // Cuenta inicial de 250us
iwhalk 0:19f9867f1730 108 uint8_t estado=0;
iwhalk 0:19f9867f1730 109 uint8_t caracter;
iwhalk 0:19f9867f1730 110 const char *buffer;
iwhalk 0:19f9867f1730 111 /* END variables */
iwhalk 0:19f9867f1730 112
iwhalk 0:19f9867f1730 113 /*
iwhalk 0:19f9867f1730 114 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
iwhalk 0:19f9867f1730 115 | Definición de Funciones Prototipo y Rutinas de los Vectores de Interrupción
iwhalk 0:19f9867f1730 116 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
iwhalk 0:19f9867f1730 117 */
iwhalk 0:19f9867f1730 118 // Las Definiciones de Funciones Prototipo
iwhalk 0:19f9867f1730 119 // y Apuntadores a Vectores de Interrupciones van aquí !
iwhalk 0:19f9867f1730 120 void TimerInt_OnInterrupt(void); // Vector de Interrupción del Ticker
iwhalk 0:19f9867f1730 121 void Setup(void); // Función de Inicialización del Sistema
iwhalk 0:19f9867f1730 122 void Config_BT(void); // Función de Configuración del Bluetooth
iwhalk 0:19f9867f1730 123 void Caratula(void); // Función que despliega la Caratula en la Terminal
iwhalk 0:19f9867f1730 124 void Eco(void); // Función que Transmite y Recibe entre Terminales
iwhalk 0:19f9867f1730 125 void Clear_Screen(void); // Función que limpia la Pantalla de la Terminal
iwhalk 0:19f9867f1730 126 void Buzzer_Beep(void); // Función que prueba del Buzzer
iwhalk 0:19f9867f1730 127 /* END prototypes */
iwhalk 0:19f9867f1730 128
iwhalk 0:19f9867f1730 129 /* END definitions */
iwhalk 0:19f9867f1730 130 /*
iwhalk 0:19f9867f1730 131 #===============================================================================
iwhalk 0:19f9867f1730 132 |
iwhalk 0:19f9867f1730 133 | P R O G R A M A P R I N C I P A L
iwhalk 0:19f9867f1730 134 |
iwhalk 0:19f9867f1730 135 #===============================================================================
iwhalk 0:19f9867f1730 136 */
iwhalk 0:19f9867f1730 137 int main()
iwhalk 0:19f9867f1730 138 {
iwhalk 0:19f9867f1730 139 //+++++++++++++++++++ Secuencia Principal +++++++++++++++++++++++++++++++++++++
iwhalk 0:19f9867f1730 140 // Inicialización de variables, puertos, interrupciones y carátula
iwhalk 0:19f9867f1730 141 key_pin = HIGH; // Bluetooth en modo de Comandos AT
iwhalk 0:19f9867f1730 142 Setup(); // Inicializa el Sistema
iwhalk 0:19f9867f1730 143 Config_BT(); // Configura el Módulo Bluetooth
iwhalk 0:19f9867f1730 144 Caratula(); // Imprime la Caratula de Inicio
iwhalk 0:19f9867f1730 145 //+++++++++++++++++++ Lazo Principal +++++++++++++++++++++++++++++++++++++++++++
iwhalk 0:19f9867f1730 146 // El Lazo del Programa principal está aquí !!!
iwhalk 0:19f9867f1730 147 while (true)
iwhalk 0:19f9867f1730 148 {
iwhalk 0:19f9867f1730 149 Eco(); // Hace ECO la terminal Serial con la terminal Bluetooth y viceversa.
iwhalk 0:19f9867f1730 150 }
iwhalk 0:19f9867f1730 151 }
iwhalk 0:19f9867f1730 152 /* END main */
iwhalk 0:19f9867f1730 153
iwhalk 0:19f9867f1730 154 /*
iwhalk 0:19f9867f1730 155 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
iwhalk 0:19f9867f1730 156 ::
iwhalk 0:19f9867f1730 157 :: V E C T O R E S D E I N T E R R U P C I Ó N
iwhalk 0:19f9867f1730 158 :: (Rutinas de Atención)
iwhalk 0:19f9867f1730 159 ::
iwhalk 0:19f9867f1730 160 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
iwhalk 0:19f9867f1730 161 */
iwhalk 0:19f9867f1730 162 // Las Rutinas de Atención a Interrupciones van aquí !
iwhalk 0:19f9867f1730 163 /*
iwhalk 0:19f9867f1730 164 ** ===================================================================
iwhalk 0:19f9867f1730 165 ** Vector : TimerInt_OnInterrupt()
iwhalk 0:19f9867f1730 166 */
iwhalk 0:19f9867f1730 167 /*!
iwhalk 0:19f9867f1730 168 ** @brief
iwhalk 0:19f9867f1730 169 ** Called after Ticker is done, [Interrupt service/event]
iwhalk 0:19f9867f1730 170 ** and it is enabled:
iwhalk 0:19f9867f1730 171 ** TimerInt.attach_us(&TimerInt_OnInterrupt, TICKER_RATE);
iwhalk 0:19f9867f1730 172 ** the event is enabled and will be executed every [TICKER_RATE]
iwhalk 0:19f9867f1730 173 ** @param
iwhalk 0:19f9867f1730 174 ** UserDataPtr - Pointer to the user or
iwhalk 0:19f9867f1730 175 ** RTOS specific data. The pointer is passed
iwhalk 0:19f9867f1730 176 ** as the parameter of Init method.
iwhalk 0:19f9867f1730 177 */
iwhalk 0:19f9867f1730 178 /* ===================================================================*/
iwhalk 0:19f9867f1730 179 void TimerInt_OnInterrupt() // Rutina de Atención al Ticker
iwhalk 0:19f9867f1730 180 {
iwhalk 0:19f9867f1730 181 counter--; // Aquí va la Rutina de Servicio !
iwhalk 0:19f9867f1730 182 if (!counter)
iwhalk 0:19f9867f1730 183 {
iwhalk 0:19f9867f1730 184 // terminal.printf("Counter Finish! \r\n");
iwhalk 0:19f9867f1730 185 led_monitor = !led_monitor; // Parapadeo del LED por Interrupción (LED Toggled)
iwhalk 0:19f9867f1730 186 counter = Rate; // Restablece el contador, Le asigna el periodo de 0.5ms (Rate=500)
iwhalk 0:19f9867f1730 187 }
iwhalk 0:19f9867f1730 188 }
iwhalk 0:19f9867f1730 189 /* END Events */
iwhalk 0:19f9867f1730 190 /*
iwhalk 0:19f9867f1730 191 ______________________________________________________________________________
iwhalk 0:19f9867f1730 192 /______________________________________________________________________________\
iwhalk 0:19f9867f1730 193 | |
iwhalk 0:19f9867f1730 194 | F U N C I O N E S P R O T O T I P O |
iwhalk 0:19f9867f1730 195 |______________________________________________________________________________|
iwhalk 0:19f9867f1730 196 \_____________________________________________________________________________/
iwhalk 0:19f9867f1730 197 */
iwhalk 0:19f9867f1730 198 // Las Funciones Prototipo van aquí !
iwhalk 0:19f9867f1730 199 /*
iwhalk 0:19f9867f1730 200 |--------------------------------------------------
iwhalk 0:19f9867f1730 201 | Función Setup()
iwhalk 0:19f9867f1730 202 |--------------------------------------------------
iwhalk 0:19f9867f1730 203 */
iwhalk 0:19f9867f1730 204 void Setup()
iwhalk 0:19f9867f1730 205 {
iwhalk 0:19f9867f1730 206 confSysClock(); // Inicialización del Sistema, Configure system clock (72MHz HSE clock, 48MHz USB clock)
iwhalk 0:19f9867f1730 207 terminal.baud(BAUD_RATE); // Se configura la velocidad de transmisión e inicia la comunicación serial.
iwhalk 0:19f9867f1730 208 Clear_Screen(); // Limpia la pantalla de la Terminal
iwhalk 0:19f9867f1730 209 Buzzer_Beep(); // Prueba el Buzzer
iwhalk 0:19f9867f1730 210 terminal.printf("The System is Wake Up!.\n\r");
iwhalk 0:19f9867f1730 211 wait (2); // Espera 2 segundos
iwhalk 0:19f9867f1730 212 TimerInt.attach_us(&TimerInt_OnInterrupt, TICKER_RATE); // Le asigna el periodo de interrupción de 1ms (TICKER_RATE=1000)
iwhalk 0:19f9867f1730 213 Clear_Screen(); // Limpia la pantalla de la Terminal
iwhalk 0:19f9867f1730 214 }
iwhalk 0:19f9867f1730 215 /*
iwhalk 0:19f9867f1730 216 |--------------------------------------------------
iwhalk 0:19f9867f1730 217 | Función Config_BT()
iwhalk 0:19f9867f1730 218 |--------------------------------------------------
iwhalk 0:19f9867f1730 219 */
iwhalk 0:19f9867f1730 220 void Config_BT() // Software Bluetooth Initialization
iwhalk 0:19f9867f1730 221 {
iwhalk 0:19f9867f1730 222 /*
iwhalk 0:19f9867f1730 223 key_pin = HIGH; // Entramos al modo de Comandos AT
iwhalk 0:19f9867f1730 224 bluetooth.baud(38400); // Velocidad del Módulo Bluetooth para comandos AT.
iwhalk 0:19f9867f1730 225 wait_ms(25); // Espermos a que se estabilize el reloj
iwhalk 0:19f9867f1730 226 bluetooth.printf("AT\r\n"); // Configura el nombre de la terminal Bluetooth.
iwhalk 0:19f9867f1730 227 bluetooth.printf("AT+ROLE=0\r\n"); // Configura el módulo Bluetooth como "Esclavo".
iwhalk 0:19f9867f1730 228 bluetooth.printf("AT+NAME=BluePill\r\n"); // Configura el nombre de la terminal Bluetooth.
iwhalk 0:19f9867f1730 229 // bluetooth.printf("AT+PSWD=4321\r\n"); // Configura el password de la terminal Bluetooth.
iwhalk 0:19f9867f1730 230 bluetooth.printf("AT+VERSION?\r\n");// Muestra la Versión del Módulo Bluetooth.
iwhalk 0:19f9867f1730 231 bluetooth.printf("AT+ADDR?\r\n"); // Muestra la Dirección de la terminal Bluetooth.
iwhalk 0:19f9867f1730 232 bluetooth.printf("AT+UART?\r\n"); // Muestra la Velocidad de Transmisión de la terminal Bluetooth.
iwhalk 0:19f9867f1730 233 key_pin=HIGH; // Inhibe al HC-05 para recibir commandos AT
iwhalk 0:19f9867f1730 234 bluetooth.baud(9600); // Velocidad del Módulo Bluetooth para datos AT.
iwhalk 0:19f9867f1730 235 // terminal.baud(BT_BAUD_RATE); // Configura la velocidad del Módulo Bluetooth.
iwhalk 0:19f9867f1730 236 bluetooth.printf("The Bluetooth is configuring Sucesfully!.\n\r");
iwhalk 0:19f9867f1730 237 wait_ms(25);
iwhalk 0:19f9867f1730 238 */
iwhalk 0:19f9867f1730 239 key_pin = HIGH; // Entramos al modo de Comandos AT
iwhalk 0:19f9867f1730 240 // bluetooth.baud(9600); // Velocidad del Módulo Bluetooth para datos AT.
iwhalk 0:19f9867f1730 241 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 242 bluetooth.baud(38400); // Velocidad del Módulo Bluetooth para comandos AT.
iwhalk 0:19f9867f1730 243 wait_ms(25); // Espermos a que se estabilize el reloj
iwhalk 0:19f9867f1730 244 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 245 bluetooth.printf("AT\r\n"); // Configura el nombre de la terminal Bluetooth.
iwhalk 0:19f9867f1730 246 wait_ms(5); // Espermos a que responda la terminal Bluetooth.
iwhalk 0:19f9867f1730 247 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 248 bluetooth.printf("AT+ROLE=1\r\n"); // Configura el módulo Bluetooth: 0="Esclavo", 1="Maestro".
iwhalk 0:19f9867f1730 249 wait_ms(5); // Espermos a que responda la terminal Bluetooth.
iwhalk 0:19f9867f1730 250 // if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 251 // bluetooth.printf("AT+CMODE=1\r\n"); // Selecciona/Verifica el modo de conección: 0 - A dirección fija 1 - A cualquier dirección, 2 - Lazo de Esclavo
iwhalk 0:19f9867f1730 252 // wait_ms(5); // Espermos a que responda la terminal Bluetooth.
iwhalk 0:19f9867f1730 253 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 254 bluetooth.printf("AT+NAME=BluePill\r\n"); // Configura el nombre de la terminal Bluetooth.
iwhalk 0:19f9867f1730 255 wait_ms(5); // Espermos a que responda la terminal Bluetooth.
iwhalk 0:19f9867f1730 256 // if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 257 // bluetooth.printf("AT+PSWD=4321\r\n"); // Configura el password de la terminal Bluetooth.
iwhalk 0:19f9867f1730 258 // wait_ms(5); // Espermos a que responda la terminal Bluetooth.
iwhalk 0:19f9867f1730 259 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 260 bluetooth.printf("AT+VERSION?\r\n");// Muestra la Versión del Módulo Bluetooth.
iwhalk 0:19f9867f1730 261 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 262 bluetooth.printf("AT+ADDR?\r\n"); // Muestra la Dirección de la terminal Bluetooth.
iwhalk 0:19f9867f1730 263 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 264 bluetooth.printf("AT+UART?\r\n"); // Muestra la Velocidad de Transmisión de la terminal Bluetooth.
iwhalk 0:19f9867f1730 265 key_pin=LOW; // Inhibe al HC-05 para recibir commandos AT
iwhalk 0:19f9867f1730 266 // bluetooth.baud(BT_BAUD_RATE); // Configura la velocidad del Módulo Bluetooth.
iwhalk 0:19f9867f1730 267 bluetooth.baud(9600); // Velocidad del Módulo Bluetooth para datos AT.
iwhalk 0:19f9867f1730 268 wait_ms(25);
iwhalk 0:19f9867f1730 269 terminal.printf("The \e[1;34;40mBluetooth\e[m was configurated Sucesfully!.\n\r");
iwhalk 0:19f9867f1730 270 wait_ms(25);
iwhalk 0:19f9867f1730 271 if (bluetooth.writable()) // Espermos para poder escribir en el Bluetooth.
iwhalk 0:19f9867f1730 272 bluetooth.printf("The \e[1;34;40mBluetooth\e[m is ready to Paring!.\n\r");
iwhalk 0:19f9867f1730 273 }
iwhalk 0:19f9867f1730 274 /*
iwhalk 0:19f9867f1730 275 |--------------------------------------------------
iwhalk 0:19f9867f1730 276 | Función Caratula()
iwhalk 0:19f9867f1730 277 |--------------------------------------------------
iwhalk 0:19f9867f1730 278 */
iwhalk 0:19f9867f1730 279 void Caratula()
iwhalk 0:19f9867f1730 280 {
iwhalk 0:19f9867f1730 281 terminal.printf ("\t\e[1;37;41mInstituto Politecnico Nacional\e[0m\n\r");
iwhalk 0:19f9867f1730 282 terminal.printf ("\e[1;37;42mESCUELA SUPERIOR DE INGENIERIA MECANICA Y ELECTRICA\e[0m\n\r\v");
iwhalk 0:19f9867f1730 283 terminal.printf ("\t\e[1;31;40mPrueba \e[1;35;40mde \e[1;33;40mla \e[1;32;40mTerminal \e[1;34;40mBluetooth \e[0m\n\r\v\v\e[0m");
iwhalk 0:19f9867f1730 284 // terminal.printf ("\t\e[1;32;40mTerminal Serial Lista!\n\r");
iwhalk 0:19f9867f1730 285 // bluetooth.printf ("\t\e[1;34;40mTerminal Bluetooth Lista!\n\r");
iwhalk 0:19f9867f1730 286 }
iwhalk 0:19f9867f1730 287 /*
iwhalk 0:19f9867f1730 288 |--------------------------------------------------
iwhalk 0:19f9867f1730 289 | Función Eco()
iwhalk 0:19f9867f1730 290 |--------------------------------------------------
iwhalk 0:19f9867f1730 291 */
iwhalk 0:19f9867f1730 292 void Eco() // Eco a la Terminal
iwhalk 0:19f9867f1730 293 {
iwhalk 0:19f9867f1730 294 if (bluetooth.readable())
iwhalk 0:19f9867f1730 295 {
iwhalk 0:19f9867f1730 296 caracter=bluetooth.getc(); // Si llega un dato por el puerto BT
iwhalk 0:19f9867f1730 297 // wait_ms(5); // Espera a que se desocupe la terminal
iwhalk 0:19f9867f1730 298 // if (terminal.writable()) // Si se peude escribir a la Terminal
iwhalk 0:19f9867f1730 299 terminal.printf("\e[1;34;40m%c",caracter); // se envía al monitor serial
iwhalk 0:19f9867f1730 300 if (bluetooth.writable())
iwhalk 0:19f9867f1730 301 bluetooth.putc(caracter); // y hace ECO con la terminal BT
iwhalk 0:19f9867f1730 302 }
iwhalk 0:19f9867f1730 303
iwhalk 0:19f9867f1730 304 if (terminal.readable())
iwhalk 0:19f9867f1730 305 {
iwhalk 0:19f9867f1730 306 caracter=terminal.getc(); // Si llega un dato por el monitor serial
iwhalk 0:19f9867f1730 307 // if (bluetooth.writable())
iwhalk 0:19f9867f1730 308 bluetooth.putc(caracter); // se envía al puerto BT
iwhalk 0:19f9867f1730 309 terminal.printf("\e[1;32;40m%c",caracter); // y hace ECO con el monitor serial
iwhalk 0:19f9867f1730 310 }
iwhalk 0:19f9867f1730 311 }
iwhalk 0:19f9867f1730 312 /*
iwhalk 0:19f9867f1730 313 |--------------------------------------------------
iwhalk 0:19f9867f1730 314 | Función Clear_Screen()
iwhalk 0:19f9867f1730 315 |--------------------------------------------------
iwhalk 0:19f9867f1730 316 */
iwhalk 0:19f9867f1730 317 void Clear_Screen()
iwhalk 0:19f9867f1730 318 {
iwhalk 0:19f9867f1730 319 // ANSI Terminal Commands
iwhalk 0:19f9867f1730 320 terminal.printf("\x1B[2J"); // secuencia de Escape \e1B[2J
iwhalk 0:19f9867f1730 321 terminal.printf("\x1B[H"); // secuencia de Escape \e1B[H
iwhalk 0:19f9867f1730 322 }
iwhalk 0:19f9867f1730 323 /*
iwhalk 0:19f9867f1730 324 |--------------------------------------------------
iwhalk 0:19f9867f1730 325 | Función Buzzer_Beep()
iwhalk 0:19f9867f1730 326 |--------------------------------------------------
iwhalk 0:19f9867f1730 327 */
iwhalk 0:19f9867f1730 328 void Buzzer_Beep() // Software routine for Buzzer Beep
iwhalk 0:19f9867f1730 329 {
iwhalk 0:19f9867f1730 330 terminal.printf("Testing Buzzer... \n\r");
iwhalk 0:19f9867f1730 331 buzzer = BUZZ_ON;
iwhalk 0:19f9867f1730 332 wait_ms(750);
iwhalk 0:19f9867f1730 333 buzzer = BUZZ_OFF;
iwhalk 0:19f9867f1730 334 wait_ms(125);
iwhalk 0:19f9867f1730 335 buzzer = BUZZ_ON;
iwhalk 0:19f9867f1730 336 wait_ms(250);
iwhalk 0:19f9867f1730 337 buzzer = BUZZ_OFF;
iwhalk 0:19f9867f1730 338 wait_ms(125);
iwhalk 0:19f9867f1730 339 buzzer = BUZZ_ON;
iwhalk 0:19f9867f1730 340 wait_ms(500);
iwhalk 0:19f9867f1730 341 buzzer = BUZZ_OFF;
iwhalk 0:19f9867f1730 342 terminal.printf("Buzzer OK ! \n\r");
iwhalk 0:19f9867f1730 343 }
iwhalk 1:7b3ea5d5e074 344 //comentario
iwhalk 0:19f9867f1730 345 /* END functions */
iwhalk 0:19f9867f1730 346
iwhalk 0:19f9867f1730 347 /* END program */
iwhalk 0:19f9867f1730 348
iwhalk 0:19f9867f1730 349 /*
iwhalk 0:19f9867f1730 350 *+******************************************************************************
iwhalk 0:19f9867f1730 351 *+ D O C U M E N T A C I Ó N
iwhalk 0:19f9867f1730 352 *+******************************************************************************
iwhalk 0:19f9867f1730 353 *+ La documentación va aquí!:
iwhalk 0:19f9867f1730 354 *+
iwhalk 0:19f9867f1730 355 *+------------------------------------------------------------------------------
iwhalk 0:19f9867f1730 356 *+ MODULO BLUETOOTH HC-05
iwhalk 0:19f9867f1730 357 *+------------------------------------------------------------------------------
iwhalk 0:19f9867f1730 358 *+
iwhalk 0:19f9867f1730 359 *+ PIN CONFIGURATION
iwhalk 0:19f9867f1730 360 *+
iwhalk 0:19f9867f1730 361 *+
iwhalk 0:19f9867f1730 362 *+ Pin Number Pin Name Description
iwhalk 0:19f9867f1730 363 *+ 1 Enable/Key This pin is used to toggle between
iwhalk 0:19f9867f1730 364 *+ Data Mode (set LOW) and AT command mode (set HiGH).
iwhalk 0:19f9867f1730 365 *+ By default it is in Data mode
iwhalk 0:19f9867f1730 366 *+ 2 Vcc Powers the module. Connect to +5V Supply voltage
iwhalk 0:19f9867f1730 367 *+ 3 Ground Ground pin of module, connect to system ground.
iwhalk 0:19f9867f1730 368 *+ 4 TX–Transmitter Transmits Serial Data. Everything received via
iwhalk 0:19f9867f1730 369 ** Bluetooth will be given out by this pin as serial data.
iwhalk 0:19f9867f1730 370 *+ 5 RX–Receiver Receive Serial Data. Every serial data given to
iwhalk 0:19f9867f1730 371 *+ this pin will be broadcasted via Bluetooth
iwhalk 0:19f9867f1730 372 *+ 6 State The state pin is connected to on board LED, it
iwhalk 0:19f9867f1730 373 *+ can be used as a feedback to check if Bluetooth
iwhalk 0:19f9867f1730 374 *+ is working properly.
iwhalk 0:19f9867f1730 375 *+ 7 LED Indicates the status of Module:
iwhalk 0:19f9867f1730 376 *+ * Blink once in 2 sec: Module has entered Command Mode
iwhalk 0:19f9867f1730 377 *+ * Repeated Blinking: Waiting for connection in Data Mode
iwhalk 0:19f9867f1730 378 *+ * Blink twice in 1 sec: Connection successful in Data Mode
iwhalk 0:19f9867f1730 379 *+ 8 Button Used to control the Key/Enable pin to toggle between
iwhalk 0:19f9867f1730 380 *+ Data and command Mode
iwhalk 0:19f9867f1730 381 *+
iwhalk 0:19f9867f1730 382 *+ HC-05 Default Settings
iwhalk 0:19f9867f1730 383 *+
iwhalk 0:19f9867f1730 384 *+ Default Bluetooth Name: “HC-05”
iwhalk 0:19f9867f1730 385 *+ Default Password: 1234 or 0000
iwhalk 0:19f9867f1730 386 *+ Default Communication: Slave
iwhalk 0:19f9867f1730 387 *+ Default Mode: Data Mode
iwhalk 0:19f9867f1730 388 *+ Data Mode Baud Rate: 9600, 8, N, 1
iwhalk 0:19f9867f1730 389 *+ Command Mode Baud Rate: 38400, 8, N, 1
iwhalk 0:19f9867f1730 390 *+ Default firmware: LINVOR
iwhalk 0:19f9867f1730 391 *+
iwhalk 0:19f9867f1730 392 *+ HC-05 Technical Specifications
iwhalk 0:19f9867f1730 393 *+
iwhalk 0:19f9867f1730 394 *+ Serial Bluetooth module for Arduino and other microcontrollers
iwhalk 0:19f9867f1730 395 *+ Operating Voltage: 4V to 6V (Typically +5V)
iwhalk 0:19f9867f1730 396 *+ Operating Current: 30mA
iwhalk 0:19f9867f1730 397 *+ Range: <100m
iwhalk 0:19f9867f1730 398 *+ Supported baud rate: 9600,19200,38400,57600,115200,230400,460800.
iwhalk 0:19f9867f1730 399 *+ Works with Serial communication (USART) and TTL compatible
iwhalk 0:19f9867f1730 400 *+ Follows IEEE 802.15.1 standardized protocol
iwhalk 0:19f9867f1730 401 *+ Uses Frequency-Hopping Spread spectrum (FHSS)
iwhalk 0:19f9867f1730 402 *+ Can operate in Master, Slave or Master/Slave mode
iwhalk 0:19f9867f1730 403 *+ Can be easily interfaced with Laptop or Mobile phones with Bluetooth
iwhalk 0:19f9867f1730 404 *+
iwhalk 0:19f9867f1730 405 *+
iwhalk 0:19f9867f1730 406 *+ Cómo utilizar el módulo Bluetooth HC-05
iwhalk 0:19f9867f1730 407 *+
iwhalk 0:19f9867f1730 408 *+ El HC-05 tiene dos modos de funcionamiento, uno es el modo de datos en el
iwhalk 0:19f9867f1730 409 *+ que puede enviar y recibir datos de otros dispositivos Bluetooth y el otro
iwhalk 0:19f9867f1730 410 *+ es el modo de comando AT donde se puede cambiar la configuración predeterminada
iwhalk 0:19f9867f1730 411 *+ del dispositivo. Podemos operar el dispositivo en cualquiera de estos dos
iwhalk 0:19f9867f1730 412 *+ modos usando el pin clave como se explica en la descripción del pin.
iwhalk 0:19f9867f1730 413 *+
iwhalk 0:19f9867f1730 414 *+ Es muy fácil emparejar el módulo HC-05 con microcontroladores porque opera
iwhalk 0:19f9867f1730 415 *+ utilizando el Protocolo de Puerto Serie (SPP). Simplemente encienda el módulo
iwhalk 0:19f9867f1730 416 *+ con + 5V y conecte el pin Rx del módulo al Tx del MCU y el pin Tx del módulo
iwhalk 0:19f9867f1730 417 *+ al Rx del MCU como se muestra en la siguiente figura
iwhalk 0:19f9867f1730 418 *+
iwhalk 0:19f9867f1730 419 *+ Para este ejemplo disponemos de un módulo Bluetooth HC-05 que podemos
iwhalk 0:19f9867f1730 420 *+ conectar al puerto Serial de la Blue Pill.
iwhalk 0:19f9867f1730 421 *+ Resumidamente hemos de conectar los pines de recepción (RX) y transmisión (TX);
iwhalk 0:19f9867f1730 422 *+ que por defecto son los pines 0 y 1 respectivamente de nuestra placa con los
iwhalk 0:19f9867f1730 423 *+ pines de transmisión (TX) y recepción (RX) del módulo de forma inversa;
iwhalk 0:19f9867f1730 424 *+ tal y como se indica en la figura.
iwhalk 0:19f9867f1730 425 *+
iwhalk 0:19f9867f1730 426 *+ Módulo HC-05 Blue Pill PIN
iwhalk 0:19f9867f1730 427 *+ KEY (EN) <---------- KEY_pin (ENable) PB_1
iwhalk 0:19f9867f1730 428 *+ VCC ----------- 5V (algunos módulos pueden operar a 3.3V)
iwhalk 0:19f9867f1730 429 *+ GND ----------- GND
iwhalk 0:19f9867f1730 430 *+ Tx ----------> Rx PB_11
iwhalk 0:19f9867f1730 431 *+ Rx <---------- Tx PB_10
iwhalk 0:19f9867f1730 432 *+
iwhalk 0:19f9867f1730 433 *+ Lo más importante a tener en cuenta es que debemos de activar el modo de
iwhalk 0:19f9867f1730 434 *+ configuración del Bluetooth a través de el PIN EN o KEY, que debe de estar
iwhalk 0:19f9867f1730 435 *+ activo con un voltaje y que en este caso conectacmos al pin de 3,3V.
iwhalk 0:19f9867f1730 436 *+
iwhalk 0:19f9867f1730 437 *+ ATENCIÓN: Hay algunos módulos HC-05 que disponen de un botón diminuto y que
iwhalk 0:19f9867f1730 438 *+ hay que apretar antes de conectarlo a la alimentación. En el momento en el
iwhalk 0:19f9867f1730 439 *+ que entre en modo configuración; el LED parpadeará más lento de lo normal y
iwhalk 0:19f9867f1730 440 *+ podemos verificar que ha cambiado de modo.
iwhalk 0:19f9867f1730 441 *+
iwhalk 0:19f9867f1730 442 *+ Conexiones del circuito del módulo Bluetooth HC-05
iwhalk 0:19f9867f1730 443 *+
iwhalk 0:19f9867f1730 444 *+ Durante el encendido, el pin de key puede conectarse a tierra para
iwhalk 0:19f9867f1730 445 *+ entrar en el modo de comando; si se deja libre, entrará de forma predeterminada
iwhalk 0:19f9867f1730 446 *+ en el modo de datos. Tan pronto como se encienda el módulo, debería poder
iwhalk 0:19f9867f1730 447 *+ encontrar el dispositivo Bluetooth como “HC-05”, luego conéctese con la
iwhalk 0:19f9867f1730 448 *+ contraseña predeterminada 1234 y comience a comunicarse con él.
iwhalk 0:19f9867f1730 449 *+ El nombre de la contraseña y otros parámetros predeterminados se pueden
iwhalk 0:19f9867f1730 450 *+ cambiar ingresando al modo de configuración.
iwhalk 0:19f9867f1730 451 *+
iwhalk 0:19f9867f1730 452 *+ Para poder comunicarse en modo configuración a través de la placa Blue Pill
iwhalk 0:19f9867f1730 453 *+ es necesario configurar la velocidad de transmisión hacia la tarjeta HC-05 a
iwhalk 0:19f9867f1730 454 *+ 38400 Bauds
iwhalk 0:19f9867f1730 455 *+
iwhalk 0:19f9867f1730 456 *+ 1. Dispositivos Bluetooth:
iwhalk 0:19f9867f1730 457 *+ El módulo Bluetooth HC-05 viene configurado de fábrica como "Esclavo" (slave),
iwhalk 0:19f9867f1730 458 *+ pero se puede cambiar para que trabaje como "maestro" (master), además al
iwhalk 0:19f9867f1730 459 *+ igual que el HC-06, se puede cambiar el nombre, código de vinculación,
iwhalk 0:19f9867f1730 460 *+ velocidad y otros parámetros más.
iwhalk 0:19f9867f1730 461 *+
iwhalk 0:19f9867f1730 462 *+ Definamos primero que es un dispositivo bluetooth maestro y dispositivo esclavo:
iwhalk 0:19f9867f1730 463 *+
iwhalk 0:19f9867f1730 464 *+ Modulo bluetooth hc-05 como esclavo:
iwhalk 0:19f9867f1730 465 *+ Cuando está configurado de esta forma, se comporta similar a un HC-06, espera
iwhalk 0:19f9867f1730 466 *+ que un dispositivo bluetooth maestro se conecte a este, generalmente se
iwhalk 0:19f9867f1730 467 *+ utiliza cuando se necesita comunicarse con una PC o Celular, pues estos se
iwhalk 0:19f9867f1730 468 *+ comportan como dispositivos maestros.
iwhalk 0:19f9867f1730 469 *+
iwhalk 0:19f9867f1730 470 *+ Modulo bluetooth hc-05 como Maestro:
iwhalk 0:19f9867f1730 471 *+ En este modo, EL HC-05 es el que inicia la conexión. Un dispositivo maestro
iwhalk 0:19f9867f1730 472 *+ solo se puede conectarse con un dispositivo esclavo. Generalmente se utiliza
iwhalk 0:19f9867f1730 473 *+ este modo para comunicarse entre módulos bluetooth. Pero es necesario antes
iwhalk 0:19f9867f1730 474 *+ especificar con que dispositivo se tiene que comunicar, esto se explicará más
iwhalk 0:19f9867f1730 475 *+ adelante
iwhalk 0:19f9867f1730 476 *+
iwhalk 0:19f9867f1730 477 *+ El módulo HC-05 viene por defecto configurado de la siguiente forma:
iwhalk 0:19f9867f1730 478 *+ - Modo o role: Esclavo
iwhalk 0:19f9867f1730 479 *+ - Nombre por defeco: HC-05
iwhalk 0:19f9867f1730 480 *+ - Código de emparejamiento por defecto: 1234
iwhalk 0:19f9867f1730 481 *+ - La velocidad por defecto (baud rate): 9600
iwhalk 0:19f9867f1730 482 *+
iwhalk 0:19f9867f1730 483 *+ 2. Modos de trabajo del HC-05::
iwhalk 0:19f9867f1730 484 *+ EL Modulo HC-05 tiene 4 estados los cuales es importante conocer:
iwhalk 0:19f9867f1730 485 *+
iwhalk 0:19f9867f1730 486 *+ Estado Desconectado:
iwhalk 0:19f9867f1730 487 *+ - Entra a este estado tan pronto alimentas el modulo, y cuando no se ha
iwhalk 0:19f9867f1730 488 *+ establecido una conexión bluetooth con ningún otro dispositivo
iwhalk 0:19f9867f1730 489 *+ - EL LED del módulo en este estado parpadea rápidamente
iwhalk 0:19f9867f1730 490 *+ - En este estado a diferencia del HC-06, el HC-05 no puede interpretar los
iwhalk 0:19f9867f1730 491 *+ comandos AT
iwhalk 0:19f9867f1730 492 *+
iwhalk 0:19f9867f1730 493 *+ Estado Conectado o de comunicación
iwhalk 0:19f9867f1730 494 *+ - Entra a este estado cuando se establece una conexión con otro dispositivo
iwhalk 0:19f9867f1730 495 *+ bluetooth.
iwhalk 0:19f9867f1730 496 *+ - El LED hace un doble parpadeo.
iwhalk 0:19f9867f1730 497 *+ - Todos los datos que se ingresen al HC-05 por el Pin RX se trasmiten por
iwhalk 0:19f9867f1730 498 *+ bluetooth al dispositivo conectado, y los datos recibidos se devuelven por
iwhalk 0:19f9867f1730 499 *+ el pin TX. La comunicación es transparente
iwhalk 0:19f9867f1730 500 *+
iwhalk 0:19f9867f1730 501 *+ Modo AT 1
iwhalk 0:19f9867f1730 502 *+ - Para entrar a este estado después de conectar y alimentar el modulo es
iwhalk 0:19f9867f1730 503 *+ necesario presionar el botón del HC-05.
iwhalk 0:19f9867f1730 504 *+ - En este estado, podemos enviar comandos AT, pero a la misma velocidad con
iwhalk 0:19f9867f1730 505 *+ el que está configurado.
iwhalk 0:19f9867f1730 506 *+ - EL LED del módulo en este estado parpadea rápidamente igual que en el
iwhalk 0:19f9867f1730 507 *+ estado desconectado.
iwhalk 0:19f9867f1730 508 *+
iwhalk 0:19f9867f1730 509 *+ Modo AT 2
iwhalk 0:19f9867f1730 510 *+ - Para entrar a este estado es necesario tener presionado el botón al momento
iwhalk 0:19f9867f1730 511 *+ de alimentar el modulo, es decir el modulo debe encender con el botón
iwhalk 0:19f9867f1730 512 *+ presionado, después de haber encendido se puede soltar y permanecerá en
iwhalk 0:19f9867f1730 513 *+ este estado.
iwhalk 0:19f9867f1730 514 *+ - En este estado, para enviar comandos AT es necesario hacerlo a la velocidad
iwhalk 0:19f9867f1730 515 *+ de 38400 baudios, esto es muy útil cuando nos olvidamos la velocidad con
iwhalk 0:19f9867f1730 516 *+ la que hemos dejado configurado nuestro modulo.
iwhalk 0:19f9867f1730 517 *+ - El LED del módulo en este estado parpadea lentamente.
iwhalk 0:19f9867f1730 518 *+
iwhalk 0:19f9867f1730 519 *+ Los siguientes pasos son para entrar al Modo AT 1 o Modo AT 2:
iwhalk 0:19f9867f1730 520 *+
iwhalk 0:19f9867f1730 521 *+ -Para entrar al modo AT 1, después de alimentar el modulo y haber encendido
iwhalk 0:19f9867f1730 522 *+ tan solo basta presionar el botón que tiene el
iwhalk 0:19f9867f1730 523 *+ módulo HC-05, el LED del módulo seguirá parpadeando
iwhalk 0:19f9867f1730 524 *+ rápidamente, por lo que para saber si hemos entrado
iwhalk 0:19f9867f1730 525 *+ al Modo AT 1 es necesario enviar comandos AT y ver
iwhalk 0:19f9867f1730 526 *+ si responde, estos comandos se verán más adelante.
iwhalk 0:19f9867f1730 527 *+ -Para entrar al modo AT 2, antes de alimentar o encender el modulo es necesario
iwhalk 0:19f9867f1730 528 *+ presionar su botón, mantener presionado y alimentar
iwhalk 0:19f9867f1730 529 *+ el modulo, después que enciende recién podemos
iwhalk 0:19f9867f1730 530 *+ soltar el botón. Si el LED Parpadea lentamente es
iwhalk 0:19f9867f1730 531 *+ porque ya está en Modo AT 2.
iwhalk 0:19f9867f1730 532 *+
iwhalk 0:19f9867f1730 533 *+ En este tutorial enviaremos los comandos AT usando el Modo AT 2, pero también
iwhalk 0:19f9867f1730 534 *+ es válido si están en el Modo AT 1, con la diferencia que tendrán que cambiar
iwhalk 0:19f9867f1730 535 *+ a la velocidad con la que tienen configurado su Bluetooth (si es la primera
iwhalk 0:19f9867f1730 536 *+ vez que configuran, la velocidad por defecto es de 9600).
iwhalk 0:19f9867f1730 537 *+
iwhalk 0:19f9867f1730 538 *+ Ahora abrimos nuestro Monitor serial Tera Term, pero puedes usar
iwhalk 0:19f9867f1730 539 *+ cualquier monitor serial.
iwhalk 0:19f9867f1730 540 *+
iwhalk 0:19f9867f1730 541 *+ En la opción Setup --> Terminal debemos escoger “Ambos LF & CR” y la velocidad
iwhalk 0:19f9867f1730 542 *+ “38400 baud” (la velocidad para comunicarse en el MODO AT 2)
iwhalk 0:19f9867f1730 543 *+
iwhalk 0:19f9867f1730 544 *+ Echo esto Podemos empezar a enviar los comandos AT a nuestro Bluetooth
iwhalk 0:19f9867f1730 545 *+
iwhalk 0:19f9867f1730 546 *+ Test de comunicación
iwhalk 0:19f9867f1730 547 *+ Lo primero es comprobar si nuestro bluetooth responde a los comandos AT
iwhalk 0:19f9867f1730 548 *+
iwhalk 0:19f9867f1730 549 *+ Enviar: AT
iwhalk 0:19f9867f1730 550 *+ Recibe: OK
iwhalk 0:19f9867f1730 551 *+
iwhalk 0:19f9867f1730 552 *+ Si recibimos como respuesta un OK entonces podemos continuar, sino verificar
iwhalk 0:19f9867f1730 553 *+ las conexiones o los pasos anteriores.
iwhalk 0:19f9867f1730 554 *+
iwhalk 0:19f9867f1730 555 *+
iwhalk 0:19f9867f1730 556 *+-----------------------------------------------------------------------------
iwhalk 0:19f9867f1730 557 *+
iwhalk 0:19f9867f1730 558 *+ MODULO BLUETOOTH HC-05
iwhalk 0:19f9867f1730 559 *+
iwhalk 0:19f9867f1730 560 *+ El módulo HC-05 es un módulo Bluetooth SPP (protocolo de puerto serie)
iwhalk 0:19f9867f1730 561 *+ fácil de usar, diseñado para una configuración de conexión serial inalámbrica
iwhalk 0:19f9867f1730 562 *+ transparente. El módulo Bluetooth de puerto serie está totalmente calificado
iwhalk 0:19f9867f1730 563 *+ como Bluetooth V2.0 + EDR (Velocidad de datos mejorada) Modulación de 3Mbps
iwhalk 0:19f9867f1730 564 *+ con transceptor de radio y banda base completos de 2.4GHz.
iwhalk 0:19f9867f1730 565 *+ Utiliza el sistema Bluetooth CSR Bluecore 04-External de un solo chip con
iwhalk 0:19f9867f1730 566 *+ tecnología CMOS y con AFH (función de salto de frecuencia adaptable).
iwhalk 0:19f9867f1730 567 *+ Tiene una huella tan pequeña como 12.7 mm x 27 mm.
iwhalk 0:19f9867f1730 568 *+
iwhalk 0:19f9867f1730 569 *+ Características del software
iwhalk 0:19f9867f1730 570 *+
iwhalk 0:19f9867f1730 571 *+ o Velocidad de transmisión predeterminada:
iwhalk 0:19f9867f1730 572 *+ 38400 bauds, Bits de datos: 8, Bit de parada: 1, Paridad: Sin paridad,
iwhalk 0:19f9867f1730 573 *+ Control de datos: tiene.
iwhalk 0:19f9867f1730 574 *+ Velocidad de transmisión permitidas:
iwhalk 0:19f9867f1730 575 *+ 9600,19200,38400,57600,115200,230400,460800.
iwhalk 0:19f9867f1730 576 *+ o Dado un pulso ascendente en PIO0, el dispositivo se desconectará.
iwhalk 0:19f9867f1730 577 *+ o Puerto de instrucción de estado PIO1: Bajo=desconectado, Alto=conectado;
iwhalk 0:19f9867f1730 578 *+ o PIO10 y PIO11 se pueden conectar al led rojo y azul por separado.
iwhalk 0:19f9867f1730 579 *+ Cuando el maestro y el esclavo están emparejados, el LED rojo y azul
iwhalk 0:19f9867f1730 580 *+ parpadea en intervalo de 1 vez/2s, mientras que el LED azul parpadea solo
iwhalk 0:19f9867f1730 581 *+ 2 veces/s.
iwhalk 0:19f9867f1730 582 *+ o Se conecta automáticamente al último dispositivo con alimentación de forma
iwhalk 0:19f9867f1730 583 *+ predeterminada.
iwhalk 0:19f9867f1730 584 *+ o Permitir que el dispositivo se conecte de forma predeterminada.
iwhalk 0:19f9867f1730 585 *+ o CÓDIGO PIN de emparejamiento automático: "0000" por defecto
iwhalk 0:19f9867f1730 586 *+ o Reconexión automática en 30 minutos cuando se desconecta como resultado
iwhalk 0:19f9867f1730 587 *+ de un rango de conexión más allá.
iwhalk 0:19f9867f1730 588 *+
iwhalk 0:19f9867f1730 589 *+ Características de hardware
iwhalk 0:19f9867f1730 590 *+
iwhalk 0:19f9867f1730 591 *+  Sensibilidad típica de -80dBm
iwhalk 0:19f9867f1730 592 *+  Hasta + 4dBm de potencia de transmisión de RF
iwhalk 0:19f9867f1730 593 *+  Operación de baja potencia E/S de 1.8V a 3.6V
iwhalk 0:19f9867f1730 594 *+  Control PIO
iwhalk 0:19f9867f1730 595 *+  Interfaz UART con velocidad de transmisión programable
iwhalk 0:19f9867f1730 596 *+  Con antena integrada
iwhalk 0:19f9867f1730 597 *+  Con conector de borde
iwhalk 0:19f9867f1730 598 *+
iwhalk 0:19f9867f1730 599 *+ Conexión al Módulo Bluetooth HC-05:
iwhalk 0:19f9867f1730 600 *+
iwhalk 0:19f9867f1730 601 *+ /
iwhalk 0:19f9867f1730 602 *+ BluePill HC-05 /
iwhalk 0:19f9867f1730 603 *+ 1 Enable/Key ---o o---> GND
iwhalk 0:19f9867f1730 604 *+ 3.3V ------ 2 Vcc
iwhalk 0:19f9867f1730 605 *+ GND ------ 3 GND
iwhalk 0:19f9867f1730 606 *+ Rx (PB_11) <----- 4 Tx
iwhalk 0:19f9867f1730 607 *+ Tx (PB_10) -----> 5 Rx
iwhalk 0:19f9867f1730 608 *+ 6 State -----------> IRQ
iwhalk 0:19f9867f1730 609 *+
iwhalk 0:19f9867f1730 610 *+ Comandos AT Soportados
iwhalk 0:19f9867f1730 611 *+
iwhalk 0:19f9867f1730 612 *+ Cómo configurar el modo a servidor (maestro):
iwhalk 0:19f9867f1730 613 ** 1. Conecte PIO11 a nivel alto. (pin 34)
iwhalk 0:19f9867f1730 614 *+ 2. Encendido, módulo en estado de comando
iwhalk 0:19f9867f1730 615 *+ 3. Usando la velocidad en baudios 38400, se envía el comando
iwhalk 0:19f9867f1730 616 *+ "AT+ROLE=1\r\n"
iwhalk 0:19f9867f1730 617 *+ al módulo, con una respuesta de
iwhalk 0:19f9867f1730 618 *+ "OK\r\n"
iwhalk 0:19f9867f1730 619 *+ significa establecer éxitos.
iwhalk 0:19f9867f1730 620 *+ 4. Conecte el PIO11 a nivel bajo, vuelva a encender el módulo, el módulo
iwhalk 0:19f9867f1730 621 *+ funciona como servidor (maestro).
iwhalk 0:19f9867f1730 622 *+
iwhalk 0:19f9867f1730 623 *+ Comandos AT:(todos terminan con \r\n)
iwhalk 0:19f9867f1730 624 *+ 1. Test command:
iwhalk 0:19f9867f1730 625 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 626 *+ AT OK -
iwhalk 0:19f9867f1730 627 *+ 2. Reset:
iwhalk 0:19f9867f1730 628 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 629 *+ AT+RESET OK -
iwhalk 0:19f9867f1730 630 *+ 3. Get firmware version
iwhalk 0:19f9867f1730 631 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 632 *+ AT+VERSION? +VERSION:<Param> Param : firmware version
iwhalk 0:19f9867f1730 633 *+ OK
iwhalk 0:19f9867f1730 634 *+
iwhalk 0:19f9867f1730 635 *+ Ejemplo:
iwhalk 0:19f9867f1730 636 *+ AT+VERSION?\r\n
iwhalk 0:19f9867f1730 637 *+ +VERSION:2.0-20100601
iwhalk 0:19f9867f1730 638 *+ OK
iwhalk 0:19f9867f1730 639 *+
iwhalk 0:19f9867f1730 640 *+ 4. Restore default
iwhalk 0:19f9867f1730 641 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 642 *+ AT+ORGL OK -
iwhalk 0:19f9867f1730 643 *+
iwhalk 0:19f9867f1730 644 *+ Estado por Omisión:
iwhalk 0:19f9867f1730 645 *+ Slave mode, pin code :1234, device name: H-C-2010-06-01 ,Baud 38400bits/s.
iwhalk 0:19f9867f1730 646 *+
iwhalk 0:19f9867f1730 647 *+ 5. Get moduleaddress
iwhalk 0:19f9867f1730 648 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 649 *+ AT+ADDR? +ADDR:<Param> Param: address of Bluetooth Module
iwhalk 0:19f9867f1730 650 *+ OK
iwhalk 0:19f9867f1730 651 *+
iwhalk 0:19f9867f1730 652 *+ Bluetooth address: NAP: UAP : LAP
iwhalk 0:19f9867f1730 653 *+
iwhalk 0:19f9867f1730 654 *+ Ejemplo:
iwhalk 0:19f9867f1730 655 *+ AT+ADDR?\r\n
iwhalk 0:19f9867f1730 656 *+ +ADDR:1234:56:abcdef
iwhalk 0:19f9867f1730 657 *+ OK
iwhalk 0:19f9867f1730 658 *+
iwhalk 0:19f9867f1730 659 *+ 6. Set/Check module name
iwhalk 0:19f9867f1730 660 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 661 *+ AT+NAME=<Param> OK Param: Bluetooth module name
iwhalk 0:19f9867f1730 662 *+ AT+NAME? +NAME:<Param> (Default: HC-05)
iwhalk 0:19f9867f1730 663 *+ OK (/FAIL)
iwhalk 0:19f9867f1730 664 *+
iwhalk 0:19f9867f1730 665 *+ Ejemplo:
iwhalk 0:19f9867f1730 666 *+ AT+NAME=HC-05\r\n set the module name to “HC-05”
iwhalk 0:19f9867f1730 667 *+ OK
iwhalk 0:19f9867f1730 668 *+ AT+NAME=BluePill\r\n set the module name to “BluePill”
iwhalk 0:19f9867f1730 669 *+ OK
iwhalk 0:19f9867f1730 670 *+ AT+NAME?\r\n
iwhalk 0:19f9867f1730 671 *+ +NAME: BluePill
iwhalk 0:19f9867f1730 672 *+ OK
iwhalk 0:19f9867f1730 673 *+
iwhalk 0:19f9867f1730 674 *+ 7. Get the Bluetooth device name:
iwhalk 0:19f9867f1730 675 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 676 *+ AT+RNAME?<Param1> 1. +NAME:<Param2> Param1,Param2: the address of
iwhalk 0:19f9867f1730 677 *+ OK Bluetooth device
iwhalk 0:19f9867f1730 678 *+ 2. FAIL
iwhalk 0:19f9867f1730 679 *+
iwhalk 0:19f9867f1730 680 *+ Ejemplo:(Device address 00:02:72:od:22:24,name:BluePill)
iwhalk 0:19f9867f1730 681 *+ AT+RNAME? 0002,72,od2224\r\n
iwhalk 0:19f9867f1730 682 *+ +RNAME:BluePill
iwhalk 0:19f9867f1730 683 *+ OK
iwhalk 0:19f9867f1730 684 *+
iwhalk 0:19f9867f1730 685 *+ 8.Set/Check module mode:
iwhalk 0:19f9867f1730 686 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 687 *+ AT+ROLE=<Param> OK Param:
iwhalk 0:19f9867f1730 688 *+ AT+ ROLE? +ROLE:<Param> 0-Slave
iwhalk 0:19f9867f1730 689 *+ 1-Master
iwhalk 0:19f9867f1730 690 *+
iwhalk 0:19f9867f1730 691 *+ 9. Set/Check device class
iwhalk 0:19f9867f1730 692 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 693 ** AT+CLASS=<Param> OK Param: Device Class
iwhalk 0:19f9867f1730 694 *+ AT+ CLASS? 1. +CLASS:<Param>
iwhalk 0:19f9867f1730 695 *+ OK
iwhalk 0:19f9867f1730 696 *+ 2. FAIL
iwhalk 0:19f9867f1730 697 *+
iwhalk 0:19f9867f1730 698 *+ 10. Set/Check GIAC (General Inquire Access Code)
iwhalk 0:19f9867f1730 699 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 700 *+ AT+IAC=<Param> 1.OK Param: GIAC
iwhalk 0:19f9867f1730 701 *+ 2.FAIL (Default: 9e8b33)
iwhalk 0:19f9867f1730 702 *+ AT+IAC +IAC:<Param>
iwhalk 0:19f9867f1730 703 *+ OK
iwhalk 0:19f9867f1730 704 *+
iwhalk 0:19f9867f1730 705 *+ Ejemplo:
iwhalk 0:19f9867f1730 706 *+ AT+IAC=9e8b3f\r\n
iwhalk 0:19f9867f1730 707 *+ OK
iwhalk 0:19f9867f1730 708 *+ AT+IAC?\r\n
iwhalk 0:19f9867f1730 709 *+ +IAC: 9e8b3f
iwhalk 0:19f9867f1730 710 *+ OK
iwhalk 0:19f9867f1730 711 *+
iwhalk 0:19f9867f1730 712 *+ 11. Set/Check --Query access patterns
iwhalk 0:19f9867f1730 713 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 714 *+ AT+INQM=<Param>, 1.OK Param:
iwhalk 0:19f9867f1730 715 *+ <Param2>, 2.FAIL 0——inquiry_mode_standard
iwhalk 0:19f9867f1730 716 *+ <Param3> 1——inquiry_mode_rssi
iwhalk 0:19f9867f1730 717 *+ Param2:
iwhalk 0:19f9867f1730 718 *+ Maximum number of Bluetooth
iwhalk 0:19f9867f1730 719 *+ devices to respond to
iwhalk 0:19f9867f1730 720 *+ Param3:
iwhalk 0:19f9867f1730 721 *+ Timeout (1-48 : 1.28s to 61.44s)
iwhalk 0:19f9867f1730 722 *+
iwhalk 0:19f9867f1730 723 *+ Ejemplo:
iwhalk 0:19f9867f1730 724 *+ AT+INQM=1,9,48\r\n
iwhalk 0:19f9867f1730 725 *+ OK AT+INQM\r\n
iwhalk 0:19f9867f1730 726 ++ +INQM: 1, 9, 48
iwhalk 0:19f9867f1730 727 *+ OK
iwhalk 0:19f9867f1730 728 *+
iwhalk 0:19f9867f1730 729 *+ 12. Set/Check PIN code:
iwhalk 0:19f9867f1730 730 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 731 *+ AT+PSWD=<Param> OK Param: PIN code(Default 1234)
iwhalk 0:19f9867f1730 732 *+ AT+ PSWD? + PSWD:<Param>
iwhalk 0:19f9867f1730 733 *+ OK
iwhalk 0:19f9867f1730 734 *+
iwhalk 0:19f9867f1730 735 *+ 13. Set/Checkserial parameter:
iwhalk 0:19f9867f1730 736 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 737 *+ AT+UART=<Param>, OK Param1: Baud
iwhalk 0:19f9867f1730 738 *+ <Param2>, Param2: Stop bit
iwhalk 0:19f9867f1730 739 *+ <Param3> Param3: Parity
iwhalk 0:19f9867f1730 740 *+ AT+ UART? +UART=<Param>,
iwhalk 0:19f9867f1730 741 *+ <Param2>,
iwhalk 0:19f9867f1730 742 *+ <Param3>
iwhalk 0:19f9867f1730 743 *+ OK
iwhalk 0:19f9867f1730 744 *+ Ejemplo:
iwhalk 0:19f9867f1730 745 *+ AT+UART=115200,1,2,\r\n
iwhalk 0:19f9867f1730 746 *+ OK
iwhalk 0:19f9867f1730 747 *+ AT+UART?
iwhalk 0:19f9867f1730 748 *+ +UART:115200,1,2
iwhalk 0:19f9867f1730 749 *+ OK
iwhalk 0:19f9867f1730 750 *+
iwhalk 0:19f9867f1730 751 *+ 14. Set/Check connect mode:
iwhalk 0:19f9867f1730 752 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 753 *+ AT+CMODE=<Param> OK Param:
iwhalk 0:19f9867f1730 754 *+ AT+ CMODE? + CMODE:<Param> 0 - connect fixed address
iwhalk 0:19f9867f1730 755 *+ OK 1 - connect any address
iwhalk 0:19f9867f1730 756 *+ 2 - slave-Loop
iwhalk 0:19f9867f1730 757 *+
iwhalk 0:19f9867f1730 758 *+ 15. Set/Check fixed address:
iwhalk 0:19f9867f1730 759 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 760 ** AT+BIND=<Param> OK Param:
iwhalk 0:19f9867f1730 761 *+ + BIND:<Param> Fixed address
iwhalk 0:19f9867f1730 762 *+ OK (Default 00:00:00:00:00:00)
iwhalk 0:19f9867f1730 763 *+
iwhalk 0:19f9867f1730 764 *+ Ejemplo:
iwhalk 0:19f9867f1730 765 *+ AT+BIND=1234,56,abcdef\r\n
iwhalk 0:19f9867f1730 766 *+ OK
iwhalk 0:19f9867f1730 767 *+ AT+BIND?\r\n
iwhalk 0:19f9867f1730 768 *+ +BIND:1234:56:abcdef
iwhalk 0:19f9867f1730 769 *+ OK
iwhalk 0:19f9867f1730 770 *+
iwhalk 0:19f9867f1730 771 *+ 16. Set/Check LED I/O
iwhalk 0:19f9867f1730 772 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 773 *+ AT+POLAR=<Param1, OK Param1:
iwhalk 0:19f9867f1730 774 *+ <Param2> 0-PIO8 low drive LED
iwhalk 0:19f9867f1730 775 *+ AT+ POLAR? +POLAR=<Param1>, 1-PIO8 high drive LED
iwhalk 0:19f9867f1730 776 *+ <Param2> Param2:
iwhalk 0:19f9867f1730 777 ** 0-PIO9 low drive LED
iwhalk 0:19f9867f1730 778 ** 1-PIO9 high drive LED
iwhalk 0:19f9867f1730 779 *+ 17. Set PIO output
iwhalk 0:19f9867f1730 780 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 781 *+ AT+PIO=<Param1>, OK Param1:
iwhalk 0:19f9867f1730 782 *+ <Param2> PIO number
iwhalk 0:19f9867f1730 783 *+ Param2:
iwhalk 0:19f9867f1730 784 *+ PIO level
iwhalk 0:19f9867f1730 785 *+ 0-low
iwhalk 0:19f9867f1730 786 *+ 1-high
iwhalk 0:19f9867f1730 787 *+ Ejemplo:
iwhalk 0:19f9867f1730 788 *+ 1. PIO10 output high level
iwhalk 0:19f9867f1730 789 *+ AT+PI0=10,1\r\n
iwhalk 0:19f9867f1730 790 *+ OK
iwhalk 0:19f9867f1730 791 *+
iwhalk 0:19f9867f1730 792 *+ 18. Set/Check –scan parameter
iwhalk 0:19f9867f1730 793 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 794 *+ AT+IPSCAN=<Param1>, OK Param1: Query time interval
iwhalk 0:19f9867f1730 795 *+ <Param2>, Param2:Query duration
iwhalk 0:19f9867f1730 796 *+ <Param3>, Param3:Paging interval
iwhalk 0:19f9867f1730 797 *+ <Param4> Param4:Call duration
iwhalk 0:19f9867f1730 798 *+ AT+IPSCAN? +IPSCAN:<Param1>,
iwhalk 0:19f9867f1730 799 *+ <Param2>,
iwhalk 0:19f9867f1730 800 *+ <Param3>,
iwhalk 0:19f9867f1730 801 *+ <Param4>
iwhalk 0:19f9867f1730 802 *+ OK
iwhalk 0:19f9867f1730 803 *+ Ejemplo:
iwhalk 0:19f9867f1730 804 *+ AT+IPSCAN=1234,500,1200,250\r\n
iwhalk 0:19f9867f1730 805 *+ OK
iwhalk 0:19f9867f1730 806 *+ AT+IPSCAN?
iwhalk 0:19f9867f1730 807 *+ +IPSCAN:1234,500,1200,250
iwhalk 0:19f9867f1730 808 *+
iwhalk 0:19f9867f1730 809 *+ 19. Set/Check –SHIFF parameter
iwhalk 0:19f9867f1730 810 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 811 *+ AT+SNIFF=<Param1>, OK Param1: Max time
iwhalk 0:19f9867f1730 812 *+ <Param2>, Param2: Min time
iwhalk 0:19f9867f1730 813 *+ <Param3>, Param3: Retry time
iwhalk 0:19f9867f1730 814 *+ <Param4> Param4: Time out
iwhalk 0:19f9867f1730 815 *+ AT+SNIFF? +SNIFF:<Param1>,
iwhalk 0:19f9867f1730 816 ** <Param2>,
iwhalk 0:19f9867f1730 817 ** <Param3>,
iwhalk 0:19f9867f1730 818 *+ <Param4>
iwhalk 0:19f9867f1730 819 *+ OK
iwhalk 0:19f9867f1730 820 *+
iwhalk 0:19f9867f1730 821 *+ 20. Set/Check securitymode
iwhalk 0:19f9867f1730 822 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 823 *+ AT+SENM=<Param1>, 1.OK Param1:
iwhalk 0:19f9867f1730 824 *+ <Param2> 2.FAIL 0——sec_mode0+off
iwhalk 0:19f9867f1730 825 *+ AT+ SENM? +SENM:<Param1>, 1——sec_mode1+non_secure
iwhalk 0:19f9867f1730 826 *+ <Param2> 2——sec_mode2_service
iwhalk 0:19f9867f1730 827 *+ OK 3——sec_mode3_link
iwhalk 0:19f9867f1730 828 *+ 3——sec_mode3_link
iwhalk 0:19f9867f1730 829 *+ 4——sec_mode_unknown
iwhalk 0:19f9867f1730 830 *+ Param2:
iwhalk 0:19f9867f1730 831 ** 0——hci_enc_mode_off
iwhalk 0:19f9867f1730 832 *+ 1——hci_enc_mode_pt_to_pt
iwhalk 0:19f9867f1730 833 *+ 2——hci_enc_mode_pt_to_pt_and_bcast
iwhalk 0:19f9867f1730 834 *+
iwhalk 0:19f9867f1730 835 *+ 21. DeleteAuthenticated Device
iwhalk 0:19f9867f1730 836 *+ Comando Respuesta Parámetros
iwhalk 0:19f9867f1730 837 *+ AT+PMSAD=<Param> OK Param: Authenticated Device Address
iwhalk 0:19f9867f1730 838 *+
iwhalk 0:19f9867f1730 839 *+ Ejemplo:
iwhalk 0:19f9867f1730 840 *+ AT+PMSAD=1234,56,abcdef\r\n
iwhalk 0:19f9867f1730 841 *+ OK