<commit_before>package main

import (
	"fmt"
	"github.com/davecheney/gpio"
	"os"
	"os/signal"
	"time"
)

func main() {
	// set GPIO25 to output mode
	pin, err := gpio.OpenPin(gpio.GPIO22, gpio.ModeInput)
	if err != nil {
		fmt.Printf("Error opening pin! %s\n", err)
		return
	}
	power, err := gpio.OpenPin(gpio.GPIO17, gpio.ModeOutput)
	if err != nil {
		fmt.Printf("Error opening pin! %s\n", err)
		return
	}

	// clean up on exit
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		for _ = range c {
			fmt.Println("Closing pin and terminating program.")
			pin.Close()
			power.Close()
			os.Exit(0)
		}
	}()

	defer pin.Close()
	err = pin.BeginWatch(gpio.EdgeFalling, func(state bool) {
		fmt.Printf("Callback: Pin %d is now %v\n\n", gpio.GPIO22, state)
	})
	if err != nil {
		fmt.Printf("Unable to watch pin: %s\n", err.Error())
		os.Exit(1)
	}

	fmt.Println("Now watching pin 22 on a rising edge.")

	for {
		fmt.Println("Power high")
		power.Set()
		time.Sleep(1000 * time.Millisecond)
		fmt.Println("Power low")
		power.Clear()
		time.Sleep(1000 * time.Millisecond)
	}

}<commit_msg>Remove state. Better exit cleanup. Better output.<commit_after>package main

import (
	"fmt"
	"github.com/davecheney/gpio"
	"os"
	"os/signal"
	"time"
)

func main() {
	// set GPIO25 to output mode
	pin, err := gpio.OpenPin(gpio.GPIO22, gpio.ModeInput)
	if err != nil {
		fmt.Printf("Error opening pin! %s\n", err)
		return
	}
	power, err := gpio.OpenPin(gpio.GPIO17, gpio.ModeOutput)
	if err != nil {
		fmt.Printf("Error opening pin! %s\n", err)
		return
	}

	// clean up on exit
	c := make(chan os.Signal, 1)
	signal.Notify(c, os.Interrupt)
	go func() {
		for _ = range c {
			fmt.Println("Closing pin and terminating program.")
			power.Clear()
			pin.Close()
			power.Close()
			os.Exit(0)
		}
	}()

	err = pin.BeginWatch(gpio.EdgeFalling, func() {
		fmt.Printf("Callback for %d triggered!\n\n", gpio.GPIO22)
	})
	if err != nil {
		fmt.Printf("Unable to watch pin: %s\n", err.Error())
		os.Exit(1)
	}

	fmt.Println("Now watching pin 22 on a falling edge.")

	for {
		fmt.Println("Setting power high")
		power.Set()
		time.Sleep(2000 * time.Millisecond)
		fmt.Println("Setting power low")
		power.Clear()
		time.Sleep(2000 * time.Millisecond)
	}

}
{'fraction_non_alphanumeric': 0.16372462488967343, 'fraction_numerical': 0.018534863195057368, 'mean_word_length': 3.318095238095238, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2096037', 'n_tokens_mistral': 973, 'n_tokens_neox': 891, 'n_words': 217}