My Account

Wish List (0)

Saved Carts

Compare

Approved Re-Seller
Follow us on Facebook! Follow us on Twitter! Follow us on Instagram!

Ryanteck RTk.GPIO - Getting Started

November 01, 2017

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)
Last update: November 01, 2017

Comments

Leave a Comment

Leave a Reply

* Name:
* Comment:
* E-mail: (Not Published)
Website: (Site url with http://)
Verification code: