Skip to content

Instantly share code, notes, and snippets.

@rigelk
Created July 30, 2014 17:05
Show Gist options
  • Save rigelk/cb0ee7f7802f0f7807f5 to your computer and use it in GitHub Desktop.
Save rigelk/cb0ee7f7802f0f7807f5 to your computer and use it in GitHub Desktop.
LED.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# untitled.py
#
# Copyright 2014 <pi@raspberrypi>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
# MA 02110-1301, USA.
#
#
import RPi.GPIO as GPIO
import time
# Pour utiliser les numéros de Pin de la RPi
GPIO.setmode(GPIO.BOARD)
# set up GPIO output channel
GPIO.setup(12, GPIO.OUT)
GPIO.setup(16, GPIO.OUT)
while True:
count1 = 0
while count1<11:
# régler le Pin 12 à 'high'
GPIO.output(12, GPIO.HIGH)
GPIO.output(16, GPIO.LOW)
time.sleep(0.5)
GPIO.output(16, GPIO.HIGH)
GPIO.output(12, GPIO.LOW)
time.sleep(0.5)
count1 += 1
count2 = 0
while count2<20:
GPIO.output(12, GPIO.HIGH)
GPIO.output(16, GPIO.HIGH)
time.sleep(0.2)
GPIO.output(16, GPIO.LOW)
GPIO.output(12, GPIO.LOW)
time.sleep(0.2)
count2 += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment