bluebit
--- blue:bit驱动¶
blue:bit 模块提供bluebit套件的掌控板库。
Contents
8x8点阵模块¶
8x8点阵模块控制类
i2c
: I2C实例对象,默认i2c=i2c.
-
Matrix.
blink_rate
(rate=None)¶
设置像素点闪烁率
rate
: 闪烁间隔时间,单位秒.默认None,常亮.
-
Matrix.
brightness
(brightness)¶
设置像素点亮度
brightness
: 亮度级别,范围0~15.
-
Matrix.
fill
(color)¶
填充所有
color
: 1亮;0灭
-
Matrix.
bitmap
(bitmap)¶
显示位图
bitmap
: 8x8点阵数据
-
Matrix.
show
()¶
显示生效
除上述函数方法外,还继承 FrameBuffer
类 ,有关其他方法,如显示字符,绘制函数。详情可查阅 micropython framebuf模块 FrameBuffer 类.
LCD1602模块¶
-
class
bluebit.
LCD1602
(i2c=<sphinx.ext.autodoc.importer._MockObject object>)[源代码]¶ LCD1602模块控制类
参数: i2c -- I2C实例对象,默认i2c=i2c. -
LEFT_TO_RIGHT
¶ 文本方向常量-从左到右
-
RIGHT_TO_LEFT
¶ 文本方向常量-从右到左
-
text_direction
¶ 文本方向
-
createChar
(location, charmap=[])[源代码]¶ 制作用户自定义 Fill one of the first 8 CGRAM locations with custom characters. The location parameter should be between 0 and 7 and pattern should provide an array of 8 bytes containing the pattern. E.g. you can easily design your custom character at http://www.quinapalus.com/hd44780udg.html To show your custom character use
参数: - location -- integer in range(8) to store the created character
- pattern (~bytes) -- len(8) describes created character
-
OLED模块¶
-
class
bluebit.
OLEDBit
(rx, tx)[源代码]¶ bluebit OLED模块类
参数: rx,tx -- 接收,发送引脚 -
font_5x7
¶ 字体常量-5*7英文字体
-
font_song16
¶ 字体常量-16*16宋体
-
font_song24
¶ 字体常量-24*24宋体
-
font_consol32
¶ 字体常量-32*32宋体
-
Print
(str, x, y, font=<sphinx.ext.autodoc.importer._MockObject object>)[源代码]¶ 显示中英文字符串,支持字体 '0' =Font5x7, '1' = 宋体16x16, '2' = 宋体24x24, '3' = Consolas32x32
参数:
-
实验探究类¶
适用的模块有电压、电流、磁场、电导率、PH、光电门、气压、力传感器。
-
class
bluebit.
DelveBit
(address, i2c=<sphinx.ext.autodoc.importer._MockObject object>)[源代码]¶ 实验探究类的blue:bit,适用的模块有电压、电流、磁场、电导率、PH、光电门、气压、力传感器
参数: - address -- 模块的I2C地址,可再模块拨动选择不同的地址避免冲突。
- i2c -- I2C实例对象,默认i2c=i2c
编码电机模块¶
-
class
bluebit.
EncoderMotor
(address, i2c=<sphinx.ext.autodoc.importer._MockObject object>)[源代码]¶ blue:bit编码电机驱动,提供pwm、cruise、position 三种驱动方式。
参数: - address -- 模块的I2C地址,可再模块拨动选择不同的地址避免冲突。
- i2c -- I2C实例对象,默认i2c=i2c
-
PWM_MODE
= b'\x05'¶ pwm模式
-
CRUISE_MODE
= b'\n'¶ 巡航模式
-
POSITION_MODE
= b'\x0f'¶ 定位模式
-
set_pwm
(speed1, speed2)[源代码]¶ pwm模式
参数: - speed1 -- 设置M1通道编码电机速度,范围-1023~1023
- speed2 -- 设置M2通道编码电机速度,范围-1023~1023