Skip to content

Commit eb52bc7

Browse files
committed
fix gpio error.
1 parent 4ac52c9 commit eb52bc7

File tree

3 files changed

+40
-43
lines changed

3 files changed

+40
-43
lines changed

pymycobot/__init__.py

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

99
__all__ = ["MyCobot", "MycobotCommandGenerater", "Angle", "Coord"]
1010

11-
__version__ = "2.5.4"
11+
__version__ = "2.5.5"
1212
__author__ = "Zachary zhang"
1313
__email__ = "lijun.zhang@elephantrobotics.com"
1414
__git_url__ = "https://github.com/elephantrobotics/pymycobot"

pymycobot/mycobot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ def gpio_init(self):
170170
"""
171171
import RPi.GPIO as GPIO
172172

173-
GPIO.setmode(GPIO.BMC)
173+
GPIO.setmode(GPIO.BCM)
174174
self.gpio = GPIO
175175

176176
def gpio_output(self, pin, v):

tests/test_generator.py

Lines changed: 38 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import os
33
import sys
44
import pytest
5+
from pprint import pprint
56

67
# Add relevant ranger module to PATH... there surely is a better way to do this...
78
sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
@@ -16,49 +17,45 @@ def setup():
1617
global mg
1718
print("")
1819
DEBUG = False
19-
f = input("Wether DEBUG mode[Y/n] (default: no):")
20-
if f in ["y", "Y", "yes", "Yes"]:
21-
DEBUG = True
2220
mg = MycobotCommandGenerater(debug=DEBUG)
2321
print("")
2422

2523

2624
def test_generator(setup):
27-
# print(mg.__dir__())
28-
print(mg.send_coords([-160, 160, 160, 0, 0, 0], 7, 2))
29-
print(mg.version())
30-
print(mg.power_on())
31-
print(mg.power_off())
32-
print(mg.release_all_servos())
33-
print(mg.is_controller_connected())
34-
print(mg.get_angles())
35-
print(mg.send_angle(1, 0, 10))
36-
print(mg.send_angles([0, 0, 0, 0, 0, 0], 5))
37-
print(mg.get_coords())
38-
print(mg.send_coord(1, 110.5, 8))
39-
print(mg.pause())
40-
print(mg.is_paused())
41-
print(mg.resume())
42-
print(mg.stop())
43-
print(mg.is_in_position([0, 0, 0, 0, 0, 0], 0))
44-
print(mg.is_moving())
45-
print(mg.jog_angle(1, 0, 1))
46-
print(mg.jog_coord(2, 1, 3))
47-
print(mg.jog_stop())
48-
print(mg.set_encoder(1, 1024))
49-
print(mg.get_encoder(2))
50-
print(mg.get_speed())
51-
print(mg.set_speed(100))
52-
print(mg.get_joint_min_angle(1))
53-
print(mg.get_joint_max_angle(2))
54-
print(mg.is_servo_enable(6))
55-
print(mg.is_all_servo_enable())
56-
print(mg.set_servo_data(0, 1, 2))
57-
print(mg.get_servo_data(1, 2))
58-
print(mg.set_servo_calibration(1))
59-
print(mg.release_servo(1))
60-
print(mg.focus_servo(1))
61-
print(mg.set_color(255, 255, 0))
62-
print(mg.set_pin_mode(1, 0))
63-
print(mg.set_digital_output(0, 1))
64-
print(mg)
25+
pprint(mg.send_coords([-160, 160, 160, 0, 0, 0], 7, 2))
26+
pprint(mg.version())
27+
pprint(mg.power_on())
28+
pprint(mg.power_off())
29+
pprint(mg.release_all_servos())
30+
pprint(mg.is_controller_connected())
31+
pprint(mg.get_angles())
32+
pprint(mg.send_angle(1, 0, 10))
33+
pprint(mg.send_angles([0, 0, 0, 0, 0, 0], 5))
34+
pprint(mg.get_coords())
35+
pprint(mg.send_coord(1, 110.5, 8))
36+
pprint(mg.pause())
37+
pprint(mg.is_paused())
38+
pprint(mg.resume())
39+
pprint(mg.stop())
40+
pprint(mg.is_in_position([0, 0, 0, 0, 0, 0], 0))
41+
pprint(mg.is_moving())
42+
pprint(mg.jog_angle(1, 0, 1))
43+
pprint(mg.jog_coord(2, 1, 3))
44+
pprint(mg.jog_stop())
45+
pprint(mg.set_encoder(1, 1024))
46+
pprint(mg.get_encoder(2))
47+
pprint(mg.get_speed())
48+
pprint(mg.set_speed(100))
49+
pprint(mg.get_joint_min_angle(1))
50+
pprint(mg.get_joint_max_angle(2))
51+
pprint(mg.is_servo_enable(6))
52+
pprint(mg.is_all_servo_enable())
53+
pprint(mg.set_servo_data(0, 1, 2))
54+
pprint(mg.get_servo_data(1, 2))
55+
pprint(mg.set_servo_calibration(1))
56+
pprint(mg.release_servo(1))
57+
pprint(mg.focus_servo(1))
58+
pprint(mg.set_color(255, 255, 0))
59+
pprint(mg.set_pin_mode(1, 0))
60+
pprint(mg.set_digital_output(0, 1))
61+
pprint(mg)

0 commit comments

Comments
 (0)