代码拉取完成,页面将自动刷新
#!/usr/bin/env python3
# Software License Agreement (BSD License)
#
# Copyright (c) 2019, UFACTORY, Inc.
# All rights reserved.
#
# Author: Vinman <vinman.wen@ufactory.cc> <vinman.cub@gmail.com>
"""
Example: Set Controller GPIO Digital/Analog
"""
import os
import sys
import time
sys.path.append(os.path.join(os.path.dirname(__file__), '../../..'))
from xarm.wrapper import XArmAPI
from configparser import ConfigParser
parser = ConfigParser()
parser.read('../robot.conf')
try:
ip = parser.get('xArm', 'ip')
except:
ip = input('Please input the xArm ip address[192.168.1.194]:')
if not ip:
ip = '192.168.1.194'
arm = XArmAPI(ip)
time.sleep(0.5)
if arm.warn_code != 0:
arm.clean_warn()
if arm.error_code != 0:
arm.clean_error()
value = 0
for i in range(8):
code = arm.set_cgpio_digital(i, value)
print('set_cgpio_digital({}, {}), code={}'.format(i, value, code))
time.sleep(0.5)
value = 1
for i in range(8):
code = arm.set_cgpio_digital(i, value)
print('set_cgpio_digital({}, {}), code={}'.format(i, value, code))
time.sleep(0.5)
value = 2.6
code = arm.set_cgpio_analog(0, value)
print('set_cgpio_analog(0, {}), code={}'.format(value, code))
value = 3.6
code = arm.set_cgpio_analog(1, value)
print('set_cgpio_analog(1, {}), code={}'.format(value, code))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。