Skip to content

EWB-Coding-for-Development/blink-led

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

blink-led

Simple script for a initializing a function that blinks an LED via a Raspberry Pi GPIO pin. Inpsired by Scott Mangold's article Lighting Up An Led Using Your Raspberry Pi and Python Raspberry Pi blinking and LED Assumes that an LED and suitable resistor are in series from the chosen GPIO pin and terminated at GND (can use pins 6,9,14,20,25 for GND). See RPi Low-level peripherals for more information on GPIO hardware.

Dependancies

raspberry-gpio-python

$ sudo apt-get update
$ sudo apt-get dist-upgrade
$ sudo apt-get install python-rpi.gpio python3-rpi.gpio

Usage

Must be executed by root or user with permission to output to GPIO pins. When blink.py is either imported or executed within the python/ipython shell, the 'blink()' function becomes available:

blink(count, period, pin_num=11)
outputs blinks to an LED via a GPIO pin (default pin 11)
count = number of LED blinks
period = number of seconds for each LED blink
pin_num = GPIO pin number to output blink to

Example:

from blink import blink

# make the LED blink 5 times, holding for 1 second per blink, output to GPIO pin 11 by default
blink(5,1)

# make the LED blink 3 times, holding for 2 seconds per blink, output to GPIO pin 7
blink(3,2,7)

About

Simple script for outputting a blinking an LED from the GPIO pins

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •  

Languages