控制crickit机器人板的circuitpython库。

adafruit-circuitpython-crickit的Python项目详细描述


简介

Documentation StatusDiscordBuild Status

这个方便的库使crickit机器人板的编码更加简单和简短。

依赖关系

此驱动程序取决于:

请确保circuitpython文件系统上的所有依赖项都可用。 这很容易通过下载来实现 the Adafruit library and driver bundle

用法示例

此示例显示如何控制库支持的所有设备。 在大多数情况下,您只需要几个导入。

# This is a mock example showing typical usage of the library for each kind of device.fromadafruit_crickitimportcrickit# Add this import if using stepper motors.# It will expose constants saying how to step: stepper.FORWARD, stepper.BACKWARD, etc.fromadafruit_motorimportstepper# Set servo 1 to 90 degreescrickit.servo_1.angle=90# Change servo settings.crickit.servo_1.actuation_range=135crickit.servo_1.set_pulse_width_range(min_pulse=850,max_pulse=2100)# You can assign a device to a variable to get a shorter name.servo_2=crickit.servo_2servo_2.throttle=0# Run a continous servo on Servo 2 backwards at half speed.crickit.continuous_servo_2.throttle=-0.5# Run the motor on Motor 1 terminals at half speed.crickit.dc_motor_1.throttle=0.5# Set Drive 1 terminal to 3/4 strength.crickit.drive_1.fraction=0.75ifcrickit.touch_1.value:print("Touched terminal Touch 1")# A single stepper motor uses up all the motor terminals.crickit.stepper_motor.onestep(direction=stepper.FORWARD)# You can also use the Drive terminals for a stepper motorcrickit.drive_stepper_motor.onestep(direction=stepper.BACKWARD)# Note: On CPX Crickit, NeoPixel pin is normally connected to A1, not to seesaw,# so this part of the demo cannot control the NeoPixel terminal.# Strip or ring of 8 NeoPixelscrickit.init_neopixel(8)crickit.neopixel.fill((100,100,100))

贡献

欢迎投稿!请阅读我们的Code of Conduct 在帮助这个项目保持热情之前。

本地建筑

压缩发布文件

要在本地构建此库,您需要安装 circuitpython-build-tools包装。

python3 -m venv .env
source .env/bin/activate
pip install circuitpython-build-tools

安装后,请确保您处于虚拟环境中:

source .env/bin/activate

然后运行生成:

circuitpython-build-bundles --filename_prefix adafruit-circuitpython-crickit --library_location .

斯芬克斯文件

sphinx用于根据代码中的rst文件和注释构建文档。第一, 安装依赖项(请随意重用上面的虚拟环境):

python3 -m venv .env
source .env/bin/activate
pip install Sphinx sphinx-rtd-theme

现在,激活虚拟环境后:

cd docs
sphinx-build -E -W -b html . _build/html

这将把文档输出到docs/_build/html。在浏览器中打开index.html以 查看它们。它还将(由于-w)错误的任何警告,像特拉维斯将。这是个很好的方法 本地验证它将通过。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java Eclipse内存分析器(MAT):不显示当前正在运行的进程   java Apache Velocity:转义字符不能作为关联数组键用于PHP   不截断零的java格式十进制输出   在另一个类文件中调用时返回空值的java getter   java集合获取连接   java解析json使用Gson登录系统应用程序强制关闭   java DelferredResult带有两个请求的ajax请求   java可降低功耗,同时应使用无线   java BoxLayout无法共享错误?   java如何使用计时器制作闹钟   java使用OAuth2保护RESTWeb服务:一般原则   java在一个jframe上显示多个图像和按钮