Stm32F103与蓝牙模块HC05控制LED灯程序
#include "stm32f10x.h"
#include "string.h"
#include "stdio.h"
unsigned char UARTbuff[100];
unsigned char AT1[32]="AT+PSWD=\"6789\"\r\n";
unsigned char AT2[32]="AT+ROLE=0\r\n";
unsigned char AT3[32]="AT+RESET\r\n";
int k=0;
static unsigned char count=0;
void delayms(unsigned int t)
{
unsigned x,y;
for(x=t;x>0;x--)
for(y=12400;y>0;y--);
}
void My_USART1_Init(unsigned long int bound)
{
GPIO_InitTypeDef GPIO_InitStrue;
USART_InitTypeDef USART_InitStrue;
NVIC_InitTypeDef NVIC_InitStrue;
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA,ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,ENABLE);
GPIO_InitStrue.GPIO_Mode=GPIO_Mode_AF_PP;
GPIO_InitStrue.GPIO_Pin=GPIO_Pin_9;
GPIO_InitStrue.GPIO_Speed=GPIO_Speed_10MHz;
GPIO_Init(GPIOA