YARPF

Raspberry Pi Logo YetAnotherRaspberryPiFanpage

LED Blink

Plan

wiring plan

Board

bread board

Code

#!/usr/bin/env python

## Import GPIO library
import RPi.GPIO as GPIO

## Import 'time' library. Allows us to use 'sleep'
import time

## Use board pin numbering
GPIO.setmode(GPIO.BOARD)

## Setup GPIO Pin 11 to OUT
GPIO.setup(11, GPIO.OUT)

try:
	# Loop forever
    while True:

		## Switch pin 11 on
		GPIO.output(11, True)

		## Wait 1 second
		time.sleep(1)

		## Switch pin 11 off
		GPIO.output(11, False)

		## Wait 1 second
		time.sleep(1)

	# Catch Ctrl-C
	except KeyboardInterrupt:
		pass

# Cleanup used GPIO ports
GPIO.cleanup()

Scratch

Scratch script

Download

Comments ?

blog comments powered by Disqus