Ryanteck RTk.GPIO - Getting Started

Ryanteck RTk.GPIO - Getting Started

This tutorial will go over writing your first program and using the RTk.GPIO and assumes you've already followed the guide to install python and the library installed. If not follow the guide here.

I'm still writing this. The demo code below should work fine if you change the number 22 to the pin which an LED is connected to (I used Pin 22 as its Green on the TrafficHAT. Changing it to 4 should blink the blue LED on the Explorer HAT.

Open your favourite IDE

Open your favourite IDE or just a python shell in a terminal to begin with.

from RTk import GPIO

from time import sleep

 

LED = 22

GPIO.setmode(GPIO.BCM)

GPIO.setup(LED,GPIO.OUT)

 

while True:

    GPIO.output(LED,1)

    sleep(1)

    GPIO.output(LED,0)

    sleep(1)

Leave a comment

All comments are moderated before being published.

This site is protected by hCaptcha and the hCaptcha Privacy Policy and Terms of Service apply.