目前在使用TI
的CC13x0
系列芯片开发,CC13x0
系列的芯片只有一个硬件串口,CC13x2
系列的芯片有两个硬件串口。但是目前为止,TI
的CC13x2
系列芯片还没有正式量产。
目前使用的是CC1310
芯片,正常情况下串口被用来输出调试信息,一般一个串口也是够用了的。但是最近需要增加一个串口的语音合成模块SYN6288
,这样一来,一个串口就不怎么够用了。
Google
搜索了一下,发现CC1310
可以软件模拟出第二个串口出来。
目前在使用TI
的CC13x0
系列芯片开发,CC13x0
系列的芯片只有一个硬件串口,CC13x2
系列的芯片有两个硬件串口。但是目前为止,TI
的CC13x2
系列芯片还没有正式量产。
目前使用的是CC1310
芯片,正常情况下串口被用来输出调试信息,一般一个串口也是够用了的。但是最近需要增加一个串口的语音合成模块SYN6288
,这样一来,一个串口就不怎么够用了。
Google
搜索了一下,发现CC1310
可以软件模拟出第二个串口出来。
目前使用某个串口工具,这个工具依赖MSCOMM32.OCX
,然而Windows7 x64
没有提供这个组件,我们需要手工注册这个组件。
最近在项目中使用TTS
串口的SYN6288
语音合成模块来输出中文语音,遇到一些问题,尤其是协议中的校验和计算的问题,折腾了好长时间。
Arduino Mega 2560
能够读取0 ~ 5V
的电压,并转换为10bit
即0~1023
级的数字信号。这怎么理解呢?
最近要使用Arduino
开发一个读取电压的装置,新电脑上没有安装Arduino IDE
,因此,从Ubuntu 16.04
软件中心中搜索找到一个名为arduino-mhall119
的软件,如下图所示:
继续阅读Ubuntu 16.04软件中心安装的Arduino IDE报告错误 – avrdude: ser_open(): can't open device "/dev/ttyACM0": Permission denied
ADS1115
读取模拟信号。树莓派自带I2C
控制器,但是默认没有启用,我们需要手工启用,具体操作如下:
I2C is a very commonly used standard designed to allow one chip to talk to another. So, since the Raspberry Pi can talk I2C we can connect it to a variety of I2C capable chips and modules.Here are some of the Adafruit projects that make use of I2C devices and modules:
The I2C bus allows multiple devices to be connected to your Raspberry Pi, each with a unique address, that can often be set by changing jumper settings on the module. It is very useful to be able to see which devices are connected to your Pi as a way of making sure everything is working.
To do this, it is worth running the following commands in the Terminal to install the i2c-tools utility.
1 2 |
$ sudo apt-get install -y python-smbus $ sudo apt-get install -y i2c-tools |
RFID Localization Using Angle of Arrival Cluster Forming
继续阅读RFID Localization Using Angle of Arrival Cluster Forming
Python的asyncore模块提供了以异步的方式写入套接字服务的客户端和服务器的基础结构。
模块主要包括:
asyncore.loop(…) - 用于循环监听网络事件。loop()函数负责检测一个字典,字典中保存dispatcher的实例。
asyncore.dispatcher类 - 一个底层套接字对象的简单封装。这个类有少数由异步循环调用的,用来事件处理的函数。
dispatcher类中的writable()和readable()在检测到一个socket可以写入或者数据到达的时候被调用,并返回一个bool值,决定是否调用handle_read或者handle_write。
asyncore.dispatcher_with_send类 - 一个 dispatcher的子类,添加了简单的缓冲输出能力,对简单的客户端很有用。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
import time import asyncore import socket import threading class EchoHandler(asyncore.dispatcher_with_send): def handle_read(self): data = self.recv(1024) if data: self.send(data) class EchoServer(asyncore.dispatcher): def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.set_reuse_addr() self.bind((host, port)) self.listen(5) def handle_accept(self): conn, addr = self.accept() print 'Incoming connection from %s' % repr(addr) self.handler = EchoHandler(conn) class EchoClient(asyncore.dispatcher): def __init__(self, host, port): asyncore.dispatcher.__init__(self) self.messages = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10'] self.create_socket(socket.AF_INET, socket.SOCK_STREAM) self.connect((host, port)) def handle_connect(self): pass def handle_close(self): self.close() def handle_read(self): print self.recv(1024) def writable(self): return (len(self.messages) > 0) def handle_write(self): if len(self.messages) > 0: self.send(self.messages.pop(0)) class EchoServerThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): server = EchoServer('localhost', 9999) asyncore.loop() class EchoClientThread(threading.Thread): def __init__(self): threading.Thread.__init__(self) def run(self): client = EchoClient('localhost', 9999) asyncore.loop() EchoServerThread().start() time.sleep(2) EchoClientThread().start() |