diff --git a/src/de/overlay/rtk-000-001.md b/src/de/overlay/rtk-000-001.md index 7198389..2c075b3 100644 --- a/src/de/overlay/rtk-000-001.md +++ b/src/de/overlay/rtk-000-001.md @@ -1,6 +1,6 @@ #Contrôleur moteur Ryanteck RTK-000-001 -###Contrôler un moteur connecté au RTK-000-001 depuis votre Raspberry Pi est aisé: +###Contrôler un moteur connecté au RTK-000-001 depuis votre Raspberry Pi est aisé: ```python -import RPi.GPIO as GPIO -import time +from gpiozero import RyanteckRobot +from time import sleep -GPIO.setmode(GPIO.BCM) -GPIO.setup(17, GPIO.OUT) -GPIO.setup(18, GPIO.OUT) +robot = RyanteckRobot() -while (True): - GPIO.output(18, 0) - time.sleep(1) - GPIO.output(17, 1); - time.sleep(5); - GPIO.output(17, 0) - time.sleep(1); - GPIO.output(18, 1); - time.sleep(5); -GPIO.cleanup() -``` \ No newline at end of file +while True: + robot.forward() + sleep(5) + robot.left() + sleep(1) + robot.backward() + sleep(5) + robot.right() + sleep(1) + robot.stop() + sleep(1) +``` + +[GPIO Zero docs](http://gpiozero.readthedocs.io/en/v1.3.1/api_boards.html#ryanteck-mcb-robot) diff --git a/src/it/overlay/rtk-000-001.md b/src/it/overlay/rtk-000-001.md index 45a9b42..c3bda10 100644 --- a/src/it/overlay/rtk-000-001.md +++ b/src/it/overlay/rtk-000-001.md @@ -1,6 +1,6 @@