<commit_before>import RPi.GPIO as GPIO
import time
import json
import requests
import pprint

URL = 'http://localhost:8080/api/v1/lights'
BUTTON_1 = 18
BUTTON_2 = 24
BUTTON_3 = 20
BUTTON_4 = 21

GPIO.setmode(GPIO.BCM)

GPIO.setup(BUTTON_1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def doPost( mode ):
   requestUrl = URL + '/' + mode
   data = {}
   data_json = json.dumps(data)
   headers = {'Content-type': 'application/json'}
   response = requests.post(requestUrl, data=data_json, headers=headers)

   print('Made request to ' + requestUrl)
   return

def checkState(button, mode):
   btn_state = GPIO.input(button)

   if btn_state == False:
       print('Button Pressed')
       doPost(mode);
       time.sleep(0.2)

while True:
    checkState(BUTTON_1, 'off')
    checkState(BUTTON_2, 'mode1')
    #checkState(BUTTON_3, 'mode2')
    #checkState(BUTTON_4, 'mode3')<commit_msg>Changed GPIO pins in button script<commit_after>import RPi.GPIO as GPIO
import time
import json
import requests
import pprint

URL = 'http://localhost:8080/api/v1/lights'
BUTTON_1 = 18
BUTTON_2 = 23  
BUTTON_3 = 24
BUTTON_4 = 21 

GPIO.setmode(GPIO.BCM)

GPIO.setup(BUTTON_1, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_2, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_3, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_4, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def doPost( mode ):
   requestUrl = URL + '/' + mode
   data = {}
   data_json = json.dumps(data)
   headers = {'Content-type': 'application/json'}
   response = requests.post(requestUrl, data=data_json, headers=headers)

   print('Made request to ' + requestUrl)
   return

def checkState(button, mode):
   btn_state = GPIO.input(button)

   if btn_state == True:
       print('Button Pressed')
       doPost(mode);
       time.sleep(0.2)

while True:
    checkState(BUTTON_1, 'off')
    checkState(BUTTON_2, 'mode1')
    checkState(BUTTON_3, 'mode2')
    checkState(BUTTON_4, 'mode3')
{'fraction_non_alphanumeric': 0.12979630506868783, 'fraction_numerical': 0.028422548555187114, 'mean_word_length': 4.266832917705735, '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': '4087128', 'n_tokens_mistral': 811, 'n_tokens_neox': 804, 'n_words': 160}