Qt系列——炫酷的Qt APP+STM32平衡小车
一、 Qt设计
采用了C++——Qt设计了炫酷的主页面,里面包含了各类仪表widget,其中有个类似钢铁侠的按钮可以触发和控制平衡小车的蜂鸣器。设计的摇杆按钮可以控制前进、后退、左转、右转、蓝牙连接等功能。
Qt_C++工程: 部分代码:
#ifndef BLE_H
#define BLE_H
#include "Frm_ControlCar.h"
#include <QWidget>
#include <QListWidgetItem>
#include <QtBluetooth/qbluetoothglobal.h>
#include <QtBluetooth/qbluetoothlocaldevice.h>
#include <qbluetoothaddress.h>
#include <qbluetoothdevicediscoveryagent.h>
#include <qbluetoothlocaldevice.h>
#include <qbluetoothsocket.h>
#include "Public/typedefine.h"
namespace Ui {
class BLE;
}
class Frm_BLE : public QWidget
{
Q_OBJECT
public:
explicit Frm_BLE(QWidget *parent = 0);
~Frm_BLE();
bool GetBlueState();
void BLE_Write(char data);
void BLE_Read();
private slots:
void on_btn_openBLE_clicked();
void on_btn_upDateBLE_clicked();
void on_btn_return_clicked();
void slotAddBLDeviToList(const QBluetoothDeviceInfo &info);
void slotFindFinish();
void slotClick(QListWidgetItem* item);
void slotConnectBLE();
void slotDisConnectBLE();
void slotConnectOK();
void slotConnectFailed();
private:
Ui::BLE *ui;
QBluetoothSocket *m_BlueSocket;
QBluetoothDeviceDiscoveryAgent *m_discoveryAgent;
QBluetoothLocalDevice *m_localDevice;
QString m_BLName = "";
bool m_bIsConnected = false;
};
//extern BOOLMY BluetoothPcRxPushFifo(INT8U uch_Data);
//extern BOOLMY BluetoothPcRxPopChar(INT8U *puch_Char);
//extern BOOLMY BluetoothPcTxPushFifo(INT8U uch_Char);
//extern BOOLMY BluetoothPcTxPopChar(INT8U *puch_Char);
//extern void BluetoothSendEnable(void);
#endif // BLE_H
#ifndef FRM_CONTROLCAR_H
#define FRM_CONTROLCAR_H
#include <QWidget>
namespace Ui {
class Frm_ControlCar;
}
class Frm_ControlCar : public QWidget
{
Q_OBJECT
public:
explicit Frm_ControlCar(QWidget *parent = 0);
~Frm_ControlCar();
protected:
void slotDoRockerDirect(int num);
void slotDoScanTan(int num);
private slots:
void on_btnToggleBlueTooth_clicked();
void on_btnInfoFrm_clicked();
private:
Ui::Frm_ControlCar *ui;
};
#endif // FRM_CONTROLCAR_H
Qt安卓界面
Qt安卓界面二、Stm32平衡小车部分
采用MPU6050六轴传感器,支持蓝牙模块、OLED、减速电机、RBG三色灯等控制,炫酷的钢铁侠开机动画。
Stm32平衡小车+Qt安卓
Stm32平衡小车+Qt安卓更多细节闲鱼搜索平衡小车。代码部分:
