RobotHardware-UESTC/Hardware/Firmware/GeekRobotTiny_Firmware v1.0/User/main.c

78 lines
1.9 KiB
C
Raw Permalink Normal View History

/******************** (C) COPYRIGHT 2023 GeekRebot *****************************
* File Name : main.c
* Current Version : V1.0 & ST 3.5.0
* Author : zhanli 719901725@qq.com
* Date of Issued : 2023.04.06 zhanli: Create
* Comments : GeekRebot STM32<EFBFBD>̼<EFBFBD>
********************************************************************************/
#include "bsp_sys.h"
#include "stdio.h"
#include "bluetooth.h"
unsigned char BLE_RX[64];
/**----------------------------------------------------------------------
* Function : main
* Description : GeekRebot<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* Author : zhanli&719901725@qq.com
* Date : 2023/04/22 zhanli
*---------------------------------------------------------------------**/
int main(void)
{
// <20><>ʼ<EFBFBD><CABC>ϵͳ<CFB5><CDB3><EFBFBD><EFBFBD>
System_Init();
// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><CABC>
Bluetooth_Init(9600);
// С<><D0A1>Ĭ<EFBFBD><C4AC>״̬Ϊֹͣ
Car_Stop();
while (1)
{
Delay_ms(20);
USART2_Receive(BLE_RX, 6);// <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
USART2_Send(BLE_RX, 6); // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8>HC-05<30><35><EFBFBD>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD>۲죬<DBB2><ECA3AC><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>ע<EFBFBD><D7A2>
//Delay_ms(500);
if((BLE_RX[3] == 0xB1)&&(BLE_RX[4]==0xB5))//<2F><><EFBFBD><EFBFBD>
{
// SetPoint = SetPoint + 10;
BLE_RX[3] = 0x00;//<2F><EFBFBD><E5BBBA>
}
if((BLE_RX[3] == 0xB3)&&(BLE_RX[4]==0xB7))//<2F><><EFBFBD><EFBFBD>
{
// SetPoint = SetPoint - 10;
BLE_RX[3] = 0x00;//<2F><EFBFBD><E5BBBA>
}
if((BLE_RX[3] == 0xB2)&&(BLE_RX[4]==0xB6))//ǰ<><C7B0>
{
Car_Go();
}
if((BLE_RX[3] == 0xB4)&&(BLE_RX[4]==0xB8))//<2F><>תȦ
{
Car_Turn_Left();
Delay_ms(500);//<2F><><EFBFBD>޽Ƕȴ<C7B6><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3>ٲ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʵ<EFBFBD>ִ<EFBFBD><D6B4>ŵ<EFBFBD>ת<EFBFBD><D7AA> 90<39>ȡ<EFBFBD>
Car_Go();
BLE_RX[3] = 0x00;//<2F><EFBFBD><E5BBBA>
}
if((BLE_RX[3] == 0xB5)&&(BLE_RX[4]==0xB9))//ͣ<><CDA3>
{
Car_Stop();
}
if((BLE_RX[3] == 0xB6)&&(BLE_RX[4]==0xBA))//<2F><>תȦ
{
Car_Turn_Right();
Delay_ms(500);//<2F><><EFBFBD>޽Ƕȴ<C7B6><C8B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڳ<EFBFBD><DAB3>ٲ<EFBFBD>ͬ<EFBFBD><CDAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>ʵ<EFBFBD>ִ<EFBFBD><D6B4>ŵ<EFBFBD>ת<EFBFBD><D7AA> 90<39>ȡ<EFBFBD>
Car_Go();
BLE_RX[3] = 0x00;//<2F><EFBFBD><E5BBBA>
}
if((BLE_RX[3] == 0xB8)&&(BLE_RX[4]==0xBC))//<2F><><EFBFBD><EFBFBD>
{
Car_Back();
}
}
}