Switch Pin Value in 30P Base Extension

Hey,

I am working with a uArm Swift Pro. I work with an LED and got it working with the Accessory Port. I use pin D30 and ground. I use set_digital_output() for this.

Now I want to use this port for something else and tried to get the LED work in der 30P Base Extension. I just need a GND and a pin to switch between 0 and 1, so there is voltage for the LED. Unluckily I am not able to switch a pin value in the back with set_digital_output(). What am I doing wrong? Or is it not possible to switch a pin value in the 30P Base Extension?

Hello,
You can refer to the following example to control the LED.

import os
import sys
sys.path.append(os.path.join(os.path.dirname(__file__), '../..'))
from uarm.wrapper import SwiftAPI

"""
pressure test: set mode
"""

swift = SwiftAPI(filters={'hwid': 'USB VID:PID=2341:0042'}, cmd_pend_size=2)

swift.waiting_ready()

print(swift.get_device_info())

mode = swift.get_mode()
print('mode:', mode)

swift.set_digital_direction(pin=35,value=1)
swift.set_digital_output(pin=35,value=1)
1 Like

That worked, thanks. :slight_smile: I had no swift.set_digital_direction(pin=35,value=1) in my code, so that was the problem.

Great, you are welcome!