# -*- coding: utf-8 -*-
import serial
filename='yjy.txt'
t = serial.Serial('COM5',57600)
b=t.read(3)
vaul=[]
i=0
y=0
p=0
while b[0]!=170 or b[1]!=170 or b[2]!=4:
b=t.read(3)
print(b)
if b[0]==b[1]==170 and b[2]==4:
a=b+t.read(5)
print(a)
if a[0] == 170 and a[1]==170 and a[2]==4 and a[3]==128 and a[4]==2:
while 1:
i=i+1
# print(i)
a=t.read(8)
# print(a)
sum=((0x80+0x02+a[5]+a[6])^0xffffffff)&0xff
if a[0]==a[1]==170 and a[2]==32:
y=1
else:
y=0
if a[0] == 170 and a[1]==170 and a[2]==4 and a[3]==128 and a[4]==2:
p=1
else:
用python接受tgam的脑波数据
最新推荐文章于 2023-08-27 22:40:16 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)