<<<<<<< HEAD
from time import sleep
import os
import signal
import subprocess
import CHIP_IO.GPIO as GPIO
import datetime

# adding an event trigger on the rising edge

is_playing = False
global musicprocess

GPIO.setup("XIO-P0", GPIO.IN)
GPIO.add_event_detect("XIO-P0", GPIO.RISING)
if GPIO.event_detected("XIO-P0"):
    print "Rising edge detected ==========="
    if not is_playing:
        fname = datetime.datetime.now().strftime("%Y-%m-%d %H:%M:%S")
        musicprocess = subprocess.Popen(['arecord', '-f', 'cd', '-D', 'hw:0,0', fname], stdout=PIPE, stderr=PIPE)
        is_playing = True
    else:
        os.killpg(os.getpdig(musicprocess.pid), signal.SIGTERM)
        is_playing = False
=======
# adding an event trigger on the rising edge

import CHIP_IO.GPIO as GPIO

channel = "XIO-P0"
record = False

GPIO.setup(channel, GPIO.IN)
>>>>>>> encoding state

while True: # continually in this state
    GPIO.wait_for_edge(channel, GPIO.RISING)
    print "Button press detected =========="
    if record:
        print "Stopping recording."
        record = False
    else:
        print "Starting recording."
        record = True

GPIO.cleanup()

@@ -1,17 +1,4 @@
-%3C%3C%3C%3C%3C%3C%3C HEAD%0A
 from
@@ -681,463 +681,5 @@
 lse%0A
-=======%0A# adding an event trigger on the rising edge%0A%0Aimport CHIP_IO.GPIO as GPIO%0A%0Achannel = %22XIO-P0%22%0Arecord = False%0A%0AGPIO.setup(channel, GPIO.IN)%0A%3E%3E%3E%3E%3E%3E%3E encoding state%0A%0Awhile True: # continually in this state%0A    GPIO.wait_for_edge(channel, GPIO.RISING)%0A    print %22Button press detected ==========%22%0A    if record:%0A        print %22Stopping recording.%22%0A        record = False%0A    else:%0A        print %22Starting recording.%22%0A        record = True%0A%0AGPIO.cleanup()
 %0A

encode state better