Created
November 4, 2013 00:27
-
-
Save boseji/7296399 to your computer and use it in GitHub Desktop.
Python code for Raspberry Pi to generate Pulse train on GPIO 7 pin 26 of P1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
####### | |
# This program would generate Squence pulse train on GPIO 7 Pin 26 of P1 | |
####### | |
import RPi.GPIO as GPIO | |
from time import sleep | |
import sys | |
import signal | |
def signal_handler(signal, frame): | |
GPIO.cleanup() | |
sys.exit(0) | |
def lopper(): | |
while 1: | |
GPIO.output(7,0) | |
sleep(0.00025) | |
GPIO.output(7,1) | |
sleep(0.00025) | |
GPIO.output(7,0) | |
sleep(0.00005) | |
GPIO.output(7,1) | |
sleep(0.00025) | |
GPIO.output(7,0) | |
sleep(0.00065) | |
GPIO.output(7,1) | |
sleep(0.00025) | |
GPIO.output(7,0) | |
sleep(0.00045) | |
GPIO.output(7,1) | |
sleep(0.00005) | |
GPIO.output(7,0) | |
sleep(0.00025) | |
GPIO.setmode(GPIO.BCM) | |
GPIO.setup(7,GPIO.OUT) | |
signal.signal(signal.SIGINT,signal_handler) | |
print("Press Ctrl+c to Stop Pulse train") | |
lopper() | |
GPIO.cleanup() | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment