pinout.vvzero.com/src/en/overlay/rtk-000-001.md

73 lines
1.4 KiB
Markdown
Raw Normal View History

<!--
---
2016-06-25 06:26:20 +08:00
name: Motor Controller Board
2016-01-31 19:03:17 +08:00
class: board
type: motor
formfactor: Custom
manufacturer: Ryanteck
description: A quick and easy way to start driving motors on your Raspberry Pi
url: https://ryanteck.uk/add-ons/6-ryanteck-rpi-motor-controller-board-0635648607160.html
buy: https://ryanteck.uk/add-ons/6-ryanteck-rpi-motor-controller-board-0635648607160.html
image: 'rtk-000-001.png'
pincount: 26
eeprom: no
2016-09-14 09:03:45 +08:00
power:
'1':
'2':
ground:
'6':
'9':
'14':
'20':
'25':
pin:
'11':
name: Motor 1 A
direction: output
active: high
'12':
name: Motor 1 B
direction: output
active: high
'15':
name: Motor 2 A
direction: output
active: high
'16':
name: Motor 2 B
direction: output
active: high
-->
#Motor Controller Board
###A quick and easy way to start driving motors on your Raspberry Pi
```python
##Simple motor script for the RTK-000-001
import RPi.GPIO as GPIO
import time
#Set to broadcom pin numbers
GPIO.setmode(GPIO.BCM)
#Motor 1 = Pins 17 and 18
#Motor 2 = Pins 22 and 23
GPIO.setup(17, GPIO.OUT)
GPIO.setup(18, GPIO.OUT)
#Now loop forever turning one direction for 5 seconds, then the other
while (True):
#Sleep 1 second then turn 17 on
GPIO.output(18, 0)
time.sleep(1)
GPIO.output(17, 1);
time.sleep(5);
#And now the other way round
GPIO.output(17, 0)
time.sleep(1);
GPIO.output(18, 1);
time.sleep(5);
#And loop back around
#And final cleanup
GPIO.cleanup()
2016-01-31 19:03:17 +08:00
```