Methods
(static) getMsg(moduleIndex) → {Promise.<float>}
- Source:
使用该函数可得到最近一次通信收到的内容,如果在程序开始后或使用clear_msg函数后没有发生过通信将返回None
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
Returns:
最新的通信内容,如果没有内容返回None
- Type
- Promise.<float>
(static) clearMsg(moduleIndex)
- Source:
清除最新的通信内容,在再次接收到新的通信内容之前调用get_msg只会返回None 调用此函数并不会影响get_unread_msg_count和read的使用
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
(static) getUnreadMsgCount(moduleIndex) → {Promise.<int>}
- Source:
该函数用于获取通信存储队列中未读内容的个数,最多存储32个未读内容
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
Returns:
通信存储队列中未读内容的个数,范围0~32
- Type
- Promise.<int>
(static) read(moduleIndex) → {Promise.<float>}
- Source:
该函数用于获取通信存储队列中未读内容,读取后会删除这个数据
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
Returns:
通信存储队列中最早的未读内容,如果没有未读的数据返回None
- Type
- Promise.<float>
(static) send(moduleIndex, number)
- Source:
发送数据。调用此函数后,与本模块通信名字相同的模块将会受到发送的内容
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
number |
float | 发送的数值 |
(static) init(moduleIndex, name)
- Source:
设置模块通信名字。只有通信名字相同的模块之间才可以互相通信,不想互相通信的模块需要设置不同的通信名字
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
name |
str | 通信名字 |
(static) getFirmwareVersion(moduleIndex) → {Promise.<int>}
- Source:
获取当前模块版本号
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
Returns:
- Type
- Promise.<int>
(static) setOnboardRGB(moduleIndex, rgb)
- Source:
设置板载LED的颜色
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
rgb |
int | '红': 1,'绿':2,'蓝':3,'浅蓝':4,'黄':5,'紫':6,'白': 7,'不亮': 8 |
(static) regMsgReceived(moduleIndex)
- Source:
注册接收消息事件,当收到消息的时候会触发事件并接收到数据,返回类型为float
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |
(static) unregMsgReceived(moduleIndex)
- Source:
注销接收消息事件
Parameters:
Name | Type | Description |
---|---|---|
moduleIndex |
int | 模块序号 |