#!/usr/bin/env python

"""Note that line 1 invokes the Python interpreter. 
It must be the first line in the script.

However, before using this script, you must install the RPi.GPIO module.
For example, from LXTerminal, you'd run this command: 
sudo apt-get install RPi.GPIO  

Then, you can run this script.
Comments explain what each statement does.

REMEMBER that Opto 22 I/O modules use negative true logic, so
0 = ON 
1 = OFF 
"""

""" Include the RPi.GPIO library and set GPIO as a local name in the script.
"""
import RPi.GPIO as GPIO

"""Set the pin-numbering scheme for the script.
"""
GPIO.setmode(GPIO.BOARD)

"""The GPIO.BOARD option identifies GPIO pins by their physical pin number.
To identify GPIO pins by their GPIO/BCM number, comment out the previous statement and uncomment this statement:
"""
"""GPIO.setmode(GPIO.BCM)
"""

"""Configure physical pin number 13 as input.
"""
GPIO.setup(13, GPIO.IN)

"""Read the input point mapped to pin 13 and store it in a variable.
"""
result = GPIO.input(13)

"""Print the value to the terminal.
"""
print "The value of result is", result

"""Configure physical pin number 15 as output.
"""
GPIO.setup(15, GPIO.OUT)

"""Turn On the output point mapped to physical point 15.
"""
GPIO.output(15, 0)

"""Turn Off the output point.
"""
GPIO.output(15, 1)