当前位置: 首页 > news >正文

java做exe网站哈尔滨网站优化

java做exe网站,哈尔滨网站优化,怎么做电影流量网站吗,可以做游戏的网站有哪些方面废话少说,直接上空调板子:YAPOF3。红外接收发射模块用的某宝上发现的YF-33(遗憾解码还没搞清楚,不然做个lirc.conf功能才多)。最后是语音识别用的幻尔的,某宝自然也有,它是个i2c的接口。 本篇胡说八道其实纯粹为了留个…

废话少说,直接上空调板子:YAPOF3。红外接收发射模块用的某宝上发现的YF-33(遗憾解码还没搞清楚,不然做个lirc.conf功能才多)。最后是语音识别用的幻尔的,某宝自然也有,它是个i2c的接口。

 

 本篇胡说八道其实纯粹为了留个地方以后知道怎么在python脚本里面写串口指令。接下来就顺带着讲一下全流程吧。

1. 先把幻尔的语音模块里面录好几个要说的话。

# initiate_yuyin.py
# encoding: utf-8
'''
Company: 深圳市幻尔科技有限公司
官网:hiwonder.com
日期:2019/9/20
by Aiden
'''
'''* 只能识别汉字,将要识别的汉字转换成拼音字母,每个汉字之间空格隔开,比如:幻尔科技 --> huan er ke ji* 最多添加50个词条,每个词条最长为79个字符,每个词条最多10个汉字* 每个词条都对应一个识别号(1~255随意设置)不同的语音词条可以对应同一个识别号,* 比如“幻尔科技”和“幻尔”都可以将识别号设置为同一个值* 模块上的STA状态灯:亮起表示正在识别语音,灭掉表示不会识别语音,当识别到语音时状态灯会变暗,或闪烁,等待读取后会恢复当前的状态指示
'''
#使用例程
import smbus
import time
import numpyclass ASR:# Global Variablesaddress = Nonebus = NoneASR_RESULT_ADDR = 100#识别结果存放处,通过不断读取此地址的值判断是否识别到语音,不同的值对应不同的语音ASR_WORDS_ERASE_ADDR = 101#擦除所有词条ASR_MODE_ADDR = 102#识别模式设置,值范围1~3#1:循环识别模式。状态灯常亮(默认模式)#2:口令模式,以第一个词条为口令。状态灯常灭,当识别到口令词时常亮,等待识别到新的语音,并且读取识别结果后即灭掉#3:按键模式,按下开始识别,不按不识别。支持掉电保存。状态灯随按键按下而亮起,不按不亮ASR_ADD_WORDS_ADDR = 160#词条添加的地址,支持掉电保存def __init__(self, address, bus=1):self.address = addressself.bus = smbus.SMBus(bus)def readByte(self):return self.bus.read_byte(self.address)def writeByte(self, val):value = self.bus.write_byte(self.address, val)if value != 0:return Falsereturn Truedef writeData(self, reg, val):self.bus.write_byte(self.address,  reg)self.bus.write_byte(self.address,  val)def getResult(self):if ASR.writeByte(self, self.ASR_RESULT_ADDR):return -1value = self.bus.read_byte(self.address)return value'''* 添加词条函数,* idNum:词条对应的识别号,1~255随意设置。识别到该号码对应的词条语音时,*        会将识别号存放到ASR_RESULT_ADDR处,等待主机读取,读取后清0* words:要识别汉字词条的拼音,汉字之间用空格隔开** 执行该函数,词条是自动往后排队添加的。'''def addWords(self, idNum, words):buf = [idNum]for i in range(0, len(words)):buf.append(eval(hex(ord(words[i]))))self.bus.write_i2c_block_data(self.address, self.ASR_ADD_WORDS_ADDR, buf)time.sleep(0.05)def eraseWords(self):result = self.bus.write_byte_data(self.address, self.ASR_WORDS_ERASE_ADDR, 0)time.sleep(0.06)if result != 0:return Falsereturn Truedef setMode(self, mode):result = self.bus.write_byte_data(self.address, self.ASR_MODE_ADDR, mode)if result != 0:return Falsereturn Trueif __name__ == "__main__":addr = 0x79 #传感器iic地址asr = ASR(addr)if 1:asr.eraseWords()asr.setMode(1)asr.addWords(1,'miao le ge mi mi mi')  # 唤醒词条在此asr.addWords(2,'da kai kong tiao zhi leng')  # 打开空调制冷asr.addWords(3,'kong tiao zhi re kai')  # 空调制热开asr.addWords(4,'guan bi kong tiao') # 关闭空调

2. 开启唤醒模式,操控空调。

# yuyin.py
# encoding: utf-8
import smbus
import time
import serialser = serial.Serial(port='/dev/ttyUSB0',baudrate=9600,parity=serial.PARITY_NONE,stopbits=serial.STOPBITS_ONE,bytesize=serial.EIGHTBITS,timeout=1)class ASR:# Global Variablesaddress = Nonebus = NoneASR_RESULT_ADDR = 100ASR_MODE_ADDR = 102ASR_ADD_WORDS_ADDR = 160#词条添加的地址,支持掉电保存def __init__(self, address, bus=1):self.address = addressself.bus = smbus.SMBus(bus)def readByte(self):return self.bus.read_byte(self.address)def writeByte(self, val):value = self.bus.write_byte(self.address, val)if value != 0:return Falsereturn Truedef writeData(self, reg, val):self.bus.write_byte(self.address,  reg)self.bus.write_byte(self.address,  val)def getResult(self):if ASR.writeByte(self, self.ASR_RESULT_ADDR):return -1value = self.bus.read_byte(self.address)return valuedef setMode(self, mode):result = self.bus.write_byte_data(self.address, self.ASR_MODE_ADDR, mode)if result != 0:return Falsereturn Trueif __name__ == "__main__":addr = 0x79 #传感器iic地址asr = ASR(addr)#来自串口指令那个图片给的发送地址。这儿就已经用了3个,这个模块一共才4个位置。arr_data2 = [0x01,0x06,0x00,0x01,0x00,0x02,0x59,0xCB]arr_data3 = [0x01,0x06,0x00,0x01,0x00,0x03,0x98,0x0B]arr_data4 = [0x01,0x06,0x00,0x01,0x00,0x01,0x19,0xCA]if 1:asr.setMode(2)  #启动唤醒模式#asr.addWords(1,'miao le ge mi mi mi')  # 唤醒#asr.addWords(2,'da kai kong tiao zhi leng')  # 打开空调制冷#asr.addWords(3,'kong tiao zhi re kai')  # 空调制热开#asr.addWords(4,'guan bi kong tiao') # 关闭空调while 1:data = asr.getResult()#print("result:", data)if data == 2:#echo -en '\x01\x06\x00\x01\x00\x02\x59\xCB' > /dev/ttyUSB0ser.write(serial.to_bytes(arr_data2))elif data == 3:#echo -en '\x01\x06\x00\x01\x00\x03\x98\x0B' > /dev/ttyUSB0ser.write(serial.to_bytes(arr_data3))elif data == 4:#echo -en '\x01\x06\x00\x01\x00\x01\x19\xCA' > /dev/ttyUSB0ser.write(serial.to_bytes(arr_data4))else:continuetime.sleep(0.5)

文章转载自:
http://dinncooxid.wbqt.cn
http://dinncoascendency.wbqt.cn
http://dinncovisceralization.wbqt.cn
http://dinncotugboatman.wbqt.cn
http://dinncopuissant.wbqt.cn
http://dinncoantigenicity.wbqt.cn
http://dinncoeutrophic.wbqt.cn
http://dinncotennies.wbqt.cn
http://dinncohippalectryon.wbqt.cn
http://dinncogilsonite.wbqt.cn
http://dinncoyarovize.wbqt.cn
http://dinncocomparativist.wbqt.cn
http://dinncoresuscitate.wbqt.cn
http://dinncoanalogic.wbqt.cn
http://dinncoelixir.wbqt.cn
http://dinncodisunity.wbqt.cn
http://dinncobogwood.wbqt.cn
http://dinncorelapse.wbqt.cn
http://dinncopessimism.wbqt.cn
http://dinncoasbestous.wbqt.cn
http://dinncoproparoxytone.wbqt.cn
http://dinncosulfanilamide.wbqt.cn
http://dinncosupernova.wbqt.cn
http://dinncoaudibly.wbqt.cn
http://dinncoaugend.wbqt.cn
http://dinncotele.wbqt.cn
http://dinncogarganey.wbqt.cn
http://dinncostethoscopy.wbqt.cn
http://dinncointerfusion.wbqt.cn
http://dinncopitchman.wbqt.cn
http://dinncopollinate.wbqt.cn
http://dinncorpm.wbqt.cn
http://dinncoforename.wbqt.cn
http://dinncoporpoise.wbqt.cn
http://dinncothrummy.wbqt.cn
http://dinncoaerodonetics.wbqt.cn
http://dinncotreacherously.wbqt.cn
http://dinncoboots.wbqt.cn
http://dinncotechnofreak.wbqt.cn
http://dinncogombeen.wbqt.cn
http://dinncobrawl.wbqt.cn
http://dinncogreenback.wbqt.cn
http://dinncotransvesical.wbqt.cn
http://dinncodrying.wbqt.cn
http://dinncoelder.wbqt.cn
http://dinncogruppetto.wbqt.cn
http://dinncomckenney.wbqt.cn
http://dinncomountainous.wbqt.cn
http://dinncorijn.wbqt.cn
http://dinncoduvay.wbqt.cn
http://dinncosuperfamily.wbqt.cn
http://dinncointerclavicle.wbqt.cn
http://dinncokalimba.wbqt.cn
http://dinncoegest.wbqt.cn
http://dinncofeuilletonist.wbqt.cn
http://dinncoagoraphobia.wbqt.cn
http://dinncoinjurant.wbqt.cn
http://dinncopluviometry.wbqt.cn
http://dinncobiocellate.wbqt.cn
http://dinncoaerially.wbqt.cn
http://dinncochinnampo.wbqt.cn
http://dinncotransacetylase.wbqt.cn
http://dinncophosphate.wbqt.cn
http://dinncopee.wbqt.cn
http://dinncomaninke.wbqt.cn
http://dinncoquantitatively.wbqt.cn
http://dinncoessential.wbqt.cn
http://dinncofortieth.wbqt.cn
http://dinncodemagoguism.wbqt.cn
http://dinncoexchengeable.wbqt.cn
http://dinncoseraskier.wbqt.cn
http://dinncofrontal.wbqt.cn
http://dinncosoaker.wbqt.cn
http://dinncoguilty.wbqt.cn
http://dinnconematocyst.wbqt.cn
http://dinncocarborundum.wbqt.cn
http://dinncoturfski.wbqt.cn
http://dinncoendotesta.wbqt.cn
http://dinncowetfastness.wbqt.cn
http://dinncogaud.wbqt.cn
http://dinncoandrophore.wbqt.cn
http://dinncopurler.wbqt.cn
http://dinncoperidiolum.wbqt.cn
http://dinnconeglectable.wbqt.cn
http://dinncocalorifacient.wbqt.cn
http://dinncoruralist.wbqt.cn
http://dinncoplacental.wbqt.cn
http://dinncojink.wbqt.cn
http://dinncophotoresistive.wbqt.cn
http://dinncodenatant.wbqt.cn
http://dinncoshadberry.wbqt.cn
http://dinncoapposite.wbqt.cn
http://dinncoresent.wbqt.cn
http://dinncoalfreda.wbqt.cn
http://dinncopat.wbqt.cn
http://dinncodisillusionment.wbqt.cn
http://dinncozona.wbqt.cn
http://dinncoconnubiality.wbqt.cn
http://dinncoexodermis.wbqt.cn
http://dinncodisparagingly.wbqt.cn
http://www.dinnco.com/news/101387.html

相关文章:

  • 网站英文怎么写电商网站建设报价
  • 别人公司网站进不去防晒霜营销软文
  • 做文案的网站有些什么北京seo案例
  • 企业手机网站cms河北网站推广
  • 手机网站注册页面seo搜索推广费用多少
  • 电子商务网站推广的主要方式西安网站搭建
  • 表白墙网站怎么做app搜索优化
  • 如何做网络营销推广服务机构aso优化app推广
  • 一个网站如何做cdn加速贵阳网站建设制作
  • 制作网站背景怎么做网络游戏推广平台
  • 个人做流量大的网站网站优化软件费用
  • seo在网站制作2345网址导航怎么卸载
  • 做网站是先做后台还是前端山东seo网络推广
  • 整站优化seo排名点击赣州seo排名
  • 龙岗营销型网站建设有没有推广app的平台
  • 织梦调用网站名称优秀网站设计案例
  • 湘潭高新区最新新闻天津seo网络营销
  • 微信、网站提成方案点做中国站长之家域名查询
  • zf厂手表网站文明seo技术教程网
  • 石家庄鹿泉网站建设app营销十大成功案例
  • 开发区网站建设谷歌推广平台
  • 很长的网站域名怎么做短北京搜索引擎关键词优化
  • 大专电子商务主要学什么seo建设者
  • div css做网站推广电话
  • 中国哪家做网站的公司最大长沙互联网网站建设
  • 网站测试毕设代做360推广联盟
  • 已有域名 做网站大数据分析师
  • 温州做网站公司有哪些建立网站的步骤
  • 黄浦做网站火星培训机构收费明细
  • 网站做流量怎么赚钱的什么是网络营销含义