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

57 lines
1.2 KiB
Markdown
Raw Normal View History

<!--
---
name: Ryanteck Motor Controller Board
manufacturer: Ryanteck
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
pincount: 26
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
-->
#Ryanteck 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()
```