Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kendricktan/ev3dev_pymotor
Control motors of Ev3 using ev3dev via python wirelessly
https://github.com/kendricktan/ev3dev_pymotor
Last synced: 22 days ago
JSON representation
Control motors of Ev3 using ev3dev via python wirelessly
- Host: GitHub
- URL: https://github.com/kendricktan/ev3dev_pymotor
- Owner: kendricktan
- Created: 2015-06-27T06:12:51.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2015-08-13T10:04:26.000Z (over 9 years ago)
- Last Synced: 2024-04-14T11:32:47.702Z (7 months ago)
- Language: Python
- Homepage:
- Size: 453 KB
- Stars: 1
- Watchers: 3
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ev3dev_pymotor
Simple way of controlling motors of NXT Ev3 using ev3dev via python wirelesslyMade for the Jessie release of ev3dev (20 May 2015)
**By default the script checks for motors plugged into ports A and B**
# Usage
## Testing motor on ev3dev
**Make sure one motor is plugged into port A**```python
import time
from ev3dev_pymotor import *
motor = ev3dev_pymotor('outA') # Or outB, outC, outD ...# Rotations per second
motor.set_rps(0.5)
motor.run_forever()
time.sleep(5)
motor.stop()
```### Establishing TCP communication between desired device and ev3
Step 1.
Execute setup_server.py on the ev3```python
python setup_server.py
```Step 2.
Execute setup_client.py [ip address] on desired device to communicate with ev3```python
python setup_client.py xxx.xxx.x.xx # where xxx.xxx.x.xx is the ip address of the ev3
```Step 3.
Run the list of commands on the desired device:
```python
format: [left|right|None] command_to_execute# Examples
run_forever # (runs all specified motors forever)
stop # (stops all specified motors)
left run_forever # (runs the left motor forever)
right change_rps(1.0) # (changes the right motor's rotation per second to '1' and runs it)
left change_rps(0.5) # (changes the left motor's rotation per second to '0.5' and runs it)
```# List of available commands
```python
/quit # terminates connection on both endrun_forever # Runs motor forever
stop # stops motor
change_rps(x) # Changes motor rotation per second to 'x' AND runs it
set_rps(x) # Sets motor rotation per second to 'x' but DOESN'T run it
toggle # Toggles motors direction
run_to_rel_position(x) # Runs motor to relative position 'x'
```