Main Menu

search

You are here

rPiBlink

[last updated: 2016-07-26]
go to: Raspberry Pi page
go to: revised program

-----

My first python program:
[WARNING: I see that copy and paste from text editor to here did not preserve the 4-spaces indentation that Python requires in the 'for' loop.]
---------------------------

#
# program name: MyProg01.py

import time
import RPi.GPIO as GPIO

# This sets the pin number, NOT the GPIO number
LED = 29

GPIO.setmode(GPIO.BOARD)
GPIO.setup(LED, GPIO.OUT)

# sets output initial LOW
GPIO.output(LED, GPIO.LOW)

for x in range(0, 5):
time.sleep(1.0)
GPIO.output(LED, GPIO.HIGH)
time.sleep(0.5)
GPIO.output(LED, GPIO.LOW)
time.sleep(1.0)

# ---------------- END program ---------

.

.

.

eof