Python Forum
Help with Button press/curl
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with Button press/curl
#3
I finally found a code that was working!

import os
import time
import RPi.GPIO as GPIO

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BOARD)
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
state = 0

while True:
    if GPIO.input (10) == GPIO.HIGH:
        if state == 0:
            print("Working")
            os.system ("curl -X POST https://maker.ifttt.com/trigger/iftttButton/with/key/YOUR_KEY")
            state = 1
            time.sleep (0.5)
    elif GPIO.input (10) ==GPIO.LOW:
        if state == 1:
            state = 0
Reply


Messages In This Thread
Help with Button press/curl - by Imbatech - Apr-01-2020, 04:34 PM
RE: Help with Button press/curl - by ndc85430 - Apr-01-2020, 05:24 PM
RE: Help with Button press/curl - by Imbatech - Apr-02-2020, 02:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Curl with source ip- pycurl drvirus 0 3,633 Sep-25-2018, 11:43 AM
Last Post: drvirus

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020