Skip to content

Commit 00215b2

Browse files
committed
chore: fix set_pwm_output()
1 parent ab21f4d commit 00215b2

File tree

4 files changed

+21
-7
lines changed

4 files changed

+21
-7
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# 2021
22

3+
## 5.27
4+
5+
- release v2.4.2
6+
- fixed `set_pwm_output()`
7+
38
## 5.24
49

510
- update demo.

pymycobot/README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -552,12 +552,19 @@ from pymycobot.mycobot import MyCobot
552552
<!-- ### set_pwm_mode()
553553
554554
- **Description**
555-
- **Parameters**
555+
- **Parameters**-->
556556

557557
### set_pwm_output()
558558

559-
- **Description**
560-
- **Parameters** -->
559+
- **Prototype**: `set_pwm_output(channel, frequency, pin_val)`
560+
561+
- **Description**: PWM control.
562+
563+
- **Parameters**
564+
565+
- `channel` (`int`): IO number.
566+
- `frequency` (`int`): clock frequency
567+
- `pin_val` (`int`): Duty cycle 0 ~ 256; 128 means 50%
561568

562569
### get_gripper_value
563570

pymycobot/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
__all__ = ["mycobot", "genre"]
44

5-
__version__ = "2.4.1"
5+
__version__ = "2.4.2"
66
__author__ = "Zachary zhang"
77
__email__ = "lijun.zhang@elephantrobotics.com"
88
__git_url__ = "https://github.com/elephantrobotics/pymycobot"

pymycobot/mycobot.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class MyCobot(MyCobotData):
6969
set_pin_mode()
7070
set_digital_output()
7171
get_digital_input()
72-
set_pwm_mode()
72+
set_pwm_mode() x
7373
set_pwm_output()
7474
get_gripper_value()
7575
set_gripper_state() *
@@ -515,11 +515,13 @@ def get_digital_input(self, pin_no):
515515
self.__mesg(Command.GET_DIGITAL_INPUT, pin_no, has_reply=True)
516516
)
517517

518+
'''
518519
def set_pwm_mode(self, pin_no, channel):
519520
self.__mesg(Command.SET_PWM_MODE, pin_no, channel)
521+
'''
520522

521-
def set_pwm_output(self, channel, pin_val):
522-
self.__mesg(Command.SET_PWM_OUTPUT, channel, pin_val)
523+
def set_pwm_output(self, channel, frequency, pin_val):
524+
self.__mesg(Command.SET_PWM_OUTPUT, channel, [frequency], pin_val)
523525

524526
def get_gripper_value(self):
525527
return self._process_single(

0 commit comments

Comments
 (0)