Laser engraving
1 Functional interface
2.13 set_pwm()
- Function: Set PWM duty cycle
- Parameter description: P:Duty cycle, range: 0-255
- Return value: None
2 Getting Started
from pymycobot.ultraArmP340 import ultraArmP340
import time
#The above should be written at the beginning of the code, meaning to import the project package
# ultraArmP340 class initialization requires two parameters: serial port and baud rate
# The first is the serial port string, such as:
# linux: "/dev/ttyUSB0"
# windows: "COM3"
# The second is the baud rate:115200
# For example
# linux:
# ua = ultraArmP340("/dev/USB0", 115200)
# windows:
# ua = ultraArmP340("COM3", 115200)
#
# Initialize an ultraArmP340 object
# Create object code for Windows version
ua = ultraArmP340("COM3", 115200)
ua.go_zero()
time.sleep(2)
ua.set_pwm(128)