Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Help with Button press/curl

I'm in need of a code that sends a notification using ifttt when i press a button on my raspberry pi.
I been looking around for hours without any luck of finding a code for this. are anyone willing to help me out with this?
the link i got from ifttt is "curl -X POST https;//maker,ifttt...."
Im using raspbian OS and python3
There are several HTTP clients for Python. One popular one is Requests.
I finally found a code that was working!

import os
import time
import RPi.GPIO as GPIO

GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
state = 0

while True:
    if GPIO.input (10) == GPIO.HIGH:
        if state == 0:
            os.system ("curl -X POST")
            state = 1
            time.sleep (0.5)
    elif GPIO.input (10) ==GPIO.LOW:
        if state == 1:
            state = 0

Top Page

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

Forum Jump:

Users browsing this thread: 1 Guest(s)