控制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构造函数SimpleCommandBus()不可见   Java字符串和返回   java不能在类中使用上下文?   使用Java为SOAP定制DataHandler   java“访问被拒绝”在编译servlet时   java嵌入Jetty,在给定时间后终止请求   java如何使用预先指定的URL限制AWS S3 bucket中对象的上传大小?   java理解Azure文件存储:未知hostException   java将对象作为参数传递是否会产生与将其存储在字段中相同级别的耦合?   https告诉java客户端代码接受自签名证书   Java中的简单*权威DNS服务器*   Java解压缩字节数组错误数据检查   当我用SpringDoc和接口描述API规范时,java Spring控制器验证似乎不起作用   在Java中使用PHash(OpenCV)   Kotlin中的java简单继承示例   java Infinispan:ISPN004016:服务器不再位于群集中(127.0.0.1:11222),正在从池中删除   2行滑动菜单安卓本机JAVA   使用日期选择器时Android Studio中的java 4错误   java在<之间删除内容!和/>