Skip to content

Instantly share code, notes, and snippets.

@allrobot
allrobot / python.py
Created March 28, 2022 04:09
测试
print("看看代码能用不,这里是https://gist.github.com/链接")
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
// #include <periph_ctr
#define SERIAL_RX_BUFFER_SIZE 2048
BLEServer *pServer = NULL;
BLECharacteristic *pTxCharacteristic;
bool deviceConnected = false;
bool oldDeviceConnected = false;
import sys
import time
import asyncio
import logging
from bleak import BleakClient
logger = logging.getLogger()
# 运行BLE客户端
import numpy as np
import sys
import time
import asyncio
import logging
from bleak import BleakClient
EMG = np.zeros(6)
import ble
from pyqtgraph import PlotWidget
import pyqtgraph as pg
import numpy as np
from PyQt5 import QtCore
class Plot_Show(object):
'''
绘图组件,输出5~550范围的数值
定义绘图时的参数:QWidget、组件y作标、组件x作标、y轴数据、组件宽高、组件对象文本
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'plot.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
import array
import random
#include <BLEDevice.h>
#include <BLEServer.h>
#include <BLEUtils.h>
#include <BLE2902.h>
// #include <periph_ctr
#define SERIAL_RX_BUFFER_SIZE 2048
BLEServer *pServer = NULL;
BLECharacteristic *pTxCharacteristic;
bool deviceConnected = false;
bool oldDeviceConnected = false;
#define SERIAL_TX_BUFFER_SIZE 4096
#include "EMGFilters.h"
const int SensorInputPin[] = {A0, A1, A2, A3, A4, A5, A8, A9};
// 处于休息状态的值,默认为0
// threshold: Relaxed baseline values.(threshold=0:in the calibration process)
unsigned long thresholds[6] = {5, 5, 5, 5, 5, 5};
// EMG_num: The number of statistical signals
unsigned long EMG_num = 0;
EMGFilters myFilter;
# -*- coding: utf-8 -*-
# self implementation generated from reading ui file 'Non_real_time_recognition.ui'
#
# Created by: PyQt5 UI code generator 5.15.4
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
import sys
#include "EMGFilters.h"
const int SensorInputPin[] = {A0, A1, A2, A3, A4, A5};
EMGFilters myFilter[6];
SAMPLE_FREQUENCY sampleRate = SAMPLE_FREQ_500HZ;
NOTCH_FREQUENCY humFreq = NOTCH_FREQ_50HZ;
void setup()
{
for (int i = 0; i < 6; i++)