Skip to content

Commit

Permalink
update test
Browse files Browse the repository at this point in the history
  • Loading branch information
zlj-zz committed Apr 27, 2021
1 parent 7da4b1a commit 4433574
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
15 changes: 15 additions & 0 deletions pymycobot/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ We support Python2, Python3.5 or later.
* [set_gripper_value](#set_gripper_value)
* [set_gripper_ini](#set_gripper_ini)
* [is_gripper_moving](#is_gripper_moving)
* [Basic](#basic)
* [set_basic_output](#set_basic_output)
* [Angle](#angle)
* [Coord](#coord)

Expand Down Expand Up @@ -605,6 +607,19 @@ from pymycobot.mycobot import MyCobot
- `1` : is moving
- `-1`: error data

## Basic

### set_basic_output

- **Prototype**: `set_basic_output(pin_no, pin_signal)`

- **Description**: Set bottom pin.

- **Parameters**

- `pin_no` (`int`) Pin number.
- `pin_signal` (`int`): 0 / 1

# Angle

```python
Expand Down
26 changes: 23 additions & 3 deletions tests/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,15 +103,15 @@ def test_jog(setup):
mc.pause()

time.sleep(3)
print(mc.is_paused()) # FIXME:
print(mc.is_paused()) # FIXME:
print("speed get", mc.get_speed())
mc.set_speed(20)
print("speed set", mc.get_speed())
assert mc.get_speed() == 20
time.sleep(6)

print("resume")
mc.resume() # FIXME:
mc.resume() # FIXME:
time.sleep(10)

coords = [160, 140, 160, 0, 0, 0]
Expand All @@ -136,7 +136,7 @@ def test_state_control(setup):
time.sleep(4)

print("is moving: 1 - true, 0 - false")
print(mc.is_moving()) # FIXME:
print(mc.is_moving()) # FIXME:
time.sleep(1)
mc.jog_angle(1, 1, 10)
time.sleep(1)
Expand Down Expand Up @@ -247,6 +247,26 @@ def test_io(setup):
mc.set_digital_output(19, 0)


def test_pump(setup):
print("==========================================================")
print("Start Pump test...")

def pump_on():
mc.set_basic_output(2, 0)
mc.set_basic_output(5, 0)

def pump_off():
mc.set_basic_output(2, 1)
mc.set_basic_output(5, 1)

pump_off()
time.sleep(3)
pump_on()
time.sleep(3)
pump_off()
time.sleep(3)


if __name__ == "__main__":
setup()
test_basic_api()

0 comments on commit 4433574

Please sign in to comment.