Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
F
face_detect
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiajunjie
face_detect
Commits
1cf7ec65
Commit
1cf7ec65
authored
May 10, 2019
by
jiajunjie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update
parent
458d56a1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
0 deletions
+31
-0
test_servo_angle_cpp.py
python/examples/test_servo_angle_cpp.py
+31
-0
test_servo_angle_python.py
python/examples/test_servo_angle_python.py
+0
-0
No files found.
python/examples/test_servo_angle_cpp.py
0 → 100644
View file @
1cf7ec65
import
time
from
ctypes
import
*
import
ctypes
import
cv2
so
=
ctypes
.
cdll
.
LoadLibrary
pwm
=
so
(
"./libPCA9685.so"
)
def
set_servo_angle
(
channel
,
angle
):
date
=
4096
*
((
angle
*
11
)
+
500
)
/
20000
pwm
.
setPWM
(
channel
,
int
(
date
))
def
get_servo_angle
(
channel
):
date
=
pwm
.
getPWM
(
channel
+
1
)
angle
=
(
20000
*
date
-
500
*
11
)
/
(
4096
*
11
)
-
45
print
(
str
(
channel
)
+
':'
+
str
(
int
(
angle
)))
# Set frequency to 50hz, good for servos.
pwm
.
setPWMFreq
(
50
)
print
(
'Moving servo on channel x, press Ctrl-C to quit...'
)
while
True
:
# Move servo on channel O between extremes.
get_servo_angle
(
1
)
get_servo_angle
(
2
)
channel
=
int
(
input
(
'pleas input channel:'
))
angle
=
int
(
input
(
'pleas input angle:'
))
set_servo_angle
(
channel
,
angle
)
time
.
sleep
(
1
)
python/examples/test_servo_angle.py
→
python/examples/test_servo_angle
_python
.py
View file @
1cf7ec65
File moved
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment