-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
65d9dc3
commit 007b8fc
Showing
10 changed files
with
299 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
|
||
.. module:: bluebit | ||
:synopsis: blue:bit驱动 | ||
|
||
:mod:`bluebit` --- blue:bit驱动 | ||
================================================== | ||
|
||
|
||
`blue:bit` 模块提供bluebit套件的掌控板库。 | ||
|
||
|
||
.. contents:: | ||
|
||
.. image:: http://wiki.labplus.cn/images/0/07/Bluebit套件1.png | ||
|
||
|
||
NTC模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.NTC | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
LM35模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.LM35 | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
四按键模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.joyButton | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
温湿度模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.SHT20 | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
颜色模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.Color | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
数字光线模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.AmbientLight | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
超声波模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.Ultrasonic | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
4段数码管模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.SEGdisplay | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
8x8点阵模块 | ||
------------- | ||
|
||
.. py:class:: Matrix(i2c=i2c) | ||
8x8点阵模块控制类 | ||
|
||
- ``i2c`` : I2C实例对象,默认i2c=i2c. | ||
|
||
.. py:method:: Matrix.blink_rate(rate=None) | ||
设置像素点闪烁率 | ||
|
||
- ``rate`` : 闪烁间隔时间,单位秒.默认None,常亮. | ||
|
||
|
||
.. py:method:: Matrix.brightness(brightness) | ||
设置像素点亮度 | ||
|
||
- ``brightness`` : 亮度级别,范围0~15. | ||
|
||
|
||
.. py:method:: Matrix.fill(color) | ||
填充所有 | ||
|
||
- ``color`` : 1亮;0灭 | ||
|
||
.. py:method:: Matrix.bitmap(bitmap) | ||
显示位图 | ||
|
||
- ``bitmap`` : 8x8点阵数据 | ||
|
||
|
||
.. py:method:: Matrix.show() | ||
显示生效 | ||
|
||
|
||
除上述函数方法外,还继承 ``FrameBuffer`` 类 ,有关其他方法,如显示字符,绘制函数。详情可查阅 micropython framebuf模块 `FrameBuffer <https://mpython.readthedocs.io/zh/master/library/micropython/framebuf.html>`_ 类. | ||
|
||
LCD1602模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.LCD1602 | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
MIDI模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.MIDI | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
|
||
MP3模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.MP3 | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
OLED模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.OLEDBit | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
红外接收模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.IRRecv | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
红外发射模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.IRTrans | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
实验探究类 | ||
------------- | ||
|
||
适用的模块有电压、电流、磁场、电导率、PH、光电门、气压、力传感器。 | ||
|
||
.. autoclass:: bluebit.DelveBit | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
||
|
||
编码电机模块 | ||
------------- | ||
|
||
.. autoclass:: bluebit.EncoderMotor | ||
:members: | ||
:undoc-members: True | ||
:exclude-members: | ||
:special-members: '__init__' | ||
:member-order: bysource | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,5 +14,6 @@ mPython类库 | |
radio.rst | ||
sdcard.rst | ||
bluebit.rst | ||
parrot.rst | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
|
||
.. module:: parrot | ||
:synopsis: 掌控拓展板驱动 | ||
|
||
:mod:`parrot` --- 掌控拓展板驱动 | ||
================================================== | ||
|
||
掌控拓展板parrot是mPython掌控板衍生的一款体积小巧、易于携带。支持电机驱动、语音播放、语音合成等功能的IO引脚扩展板,可扩展12路IO接口和2路I2C接口。 | ||
该库为掌控拓展板提供电机驱动,LED驱动等功能。 | ||
|
||
电机控制I2C通讯协议数据格式: | ||
|
||
======== ======== =========== =========== | ||
Type Command motor_no speed(int) | ||
控制电机 0x01 0x01/0x02 -100~100 | ||
======== ======== =========== =========== | ||
|
||
*当 'speed' 为负值,反转;当为正值,正转。* | ||
|
||
-------------------------------------------------- | ||
|
||
.. automodule:: parrot | ||
:members: | ||
:member-order: bysource | ||
|
||
|
||
.. literalinclude:: /../examples/motor_simple.py | ||
:caption: 电机驱动示例 | ||
:linenos: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import parrot | ||
from mpython import sleep_ms,sleep | ||
|
||
# 可设置速度范围为-100到100。 | ||
# 当值为正值时,电机正转;为负值时,电机反转; | ||
|
||
|
||
while True: | ||
|
||
# 设置正转速度100 | ||
parrot.set_speed(parrot.MOTOR_1,100) | ||
parrot.set_speed(parrot.MOTOR_2,100) | ||
print("current motor speend: %d,%d" %(parrot.get_speed(parrot.MOTOR_1),parrot.get_speed(parrot.MOTOR_2))) #获取电机速度 | ||
sleep(5) | ||
# 设置反转速度100 | ||
parrot.set_speed(parrot.MOTOR_1,-100) | ||
parrot.set_speed(parrot.MOTOR_2,-100) | ||
print("current motor speend: %d,%d" %(parrot.get_speed(parrot.MOTOR_1),parrot.get_speed(parrot.MOTOR_2))) #获取电机速度 | ||
sleep(5) | ||
# 停止 | ||
parrot.set_speed(parrot.MOTOR_1,0) | ||
parrot.set_speed(parrot.MOTOR_2,0) | ||
print("current motor speend: %d,%d" %(parrot.get_speed(parrot.MOTOR_1),parrot.get_speed(parrot.MOTOR_2))) #获取电机速度 | ||
sleep(2) |
Binary file not shown.
Binary file not shown.