<commit_before><commit_msg>Create pirtoifttt.lua<commit_after>ledpin, pirsensorpin = 4, 2
gpio.mode(pirsensorpin, gpio.INT, gpio.PULLUP)
gpio.mode(ledpin, gpio.OUTPUT)

-- Change this
APPLET = "put the name of the IFTTT applet here"
THE_API_KEY = "put the API key from IFTTT here"

URL = "http://maker.ifttt.com/trigger/"..APPLET.."/with/key/"

function movement()
  print(tmr.time() .. "PIR sensor detected movement")
  gpio.write(ledpin, gpio.LOW)                    -- gpio.LOW is led ON
  if wifi.sta.status() == 5 then                  -- Valid IP address?
    http.get(URL..THE_API_KEY.."?value1="..tmr.time())
    print(URL..THE_API_KEY.."?value1="..tmr.time())
  else
    print("No IP address. Use wifi.sta.config() first")
  end
  tmr.alarm(0, 2000, tmr.ALARM_SINGLE, function() -- Led off after 2 seconden
    gpio.write(ledpin, gpio.HIGH)                 -- gpio.HIGH is led OFF
  end)
end

-- Call the movement function if the signal goes from low to high ("up")
gpio.trig(pirsensorpin, "up", movement)           -- Reference to the movement function
{'fraction_non_alphanumeric': 0.14218455743879474, 'fraction_numerical': 0.010357815442561206, 'mean_word_length': 2.8937728937728937, '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': '5953946', 'n_tokens_mistral': 380, 'n_tokens_neox': 364, 'n_words': 99}