机器人工具包
项目描述
robot_kit
在Freenove 4WD智能车套件中玩乐
安装
SSH到您的树莓派并安装Python 3的Python模块。
$ sudo pip3 install robot_kit
示例
请参阅示例目录以获取所有代码,以下是 examples/robot_start.py 的代码列表
from robot_kit.leds import NeoPixelStrip
from robot_kit.wheels import Wheels
from robot_kit.ultrasonic import Ultrasonic
import time
if __name__ == '__main__':
"""Run some of the basic commands for robot_kit"""
"""Test for the NeoPixelStrip class"""
led_strip = NeoPixelStrip()
# Turn the LEDs Yellow and then Green
led_strip.on(128, 128, 0)
time.sleep(1.0)
led_strip.on(0, 255, 0)
time.sleep(1.0)
led_strip.off()
# Turn the wheels
wheels = Wheels()
wheels.all(0.25)
time.sleep(1.0)
wheels.stop()
# Get the distance from the Ultrasonic sensor
dis_sensor = Ultrasonic()
for i in range(50):
print(dis_sensor.get_distance())
time.sleep(0.5)
注意:为了运行此代码,您需要以sudo身份运行,因为LED库需要它。
$ sudo python3 robot_start.py
项目详情
下载文件
下载适合您平台的文件。如果您不确定要选择哪个,请了解有关 安装软件包 的更多信息。
源分布
robot_kit-0.1.5.tar.gz (7.5 kB 查看散列)
构建分布
robot_kit-0.1.5-py2.py3-none-any.whl (13.1 kB 查看散列)