This commit is contained in:
but0n 2016-08-23 00:15:46 +08:00
parent f9996f8672
commit 6e6137a02f
3 changed files with 21 additions and 3 deletions

View File

@ -7,6 +7,7 @@
void wifi_init();
void wifi_sendSingleByte(unsigned char cmd);
void wifi_sendData();
void wifi_sendData(char * cmd);
void wifi_sendCmd(char * cmd);
#endif

View File

@ -33,6 +33,18 @@ void wifi_sendSingleByte(unsigned char cmd) {
while((USART3->SR & 0x40) == 0);
}
void wifi_sendData() {
void wifi_sendData(char * cmd) {
unsigned short pointer = 0;
while(*(cmd + pointer)) {
wifi_sendSingleByte((unsigned char)*(cmd + pointer));
pointer++;
}
wifi_sendSingleByte(0x0D);
wifi_sendSingleByte(0x0A);
}
void wifi_sendCmd(char * cmd) {
wifi_sendData("AT+");
wifi_sendData(cmd);
}

View File

@ -4,7 +4,7 @@
#include "mpu6050.h"
#include "motor.h"
#include "uart.h"
#include "wifi.h"
#include "key.h"
#define Kp 100.0f //比例增益支配率(常量)
@ -111,6 +111,11 @@ int main() {
uart_init(72, 115200);
MPU_init();
wifi_init();
wifi_sendCmd("CWMODE=2");
SixAxis sourceData;