Oct-05-2018, 01:43 AM
Seems to be happy with indents now. Thnx all for help :)
Its for sending a push notification through prowl api server when pin 15 and ground are connected on my RPi.
Its like its loading. But i guess i should ask on a raspberry forum for that matter :)
Its for sending a push notification through prowl api server when pin 15 and ground are connected on my RPi.
#!/bin/usr/bin/python # Imports for Pyrowl from pyrowl import Pyrowl from pprint import pprint import os # Imports for GPIO import time import RPi.GPIO as GPIO GPIO.setmode(GPIO.BOARD) # Setup pyrowl with API key p = None p = Pyrowl("4f9b21b6b3cdf3cf41xxxxxxxxxxxx") # Setup GPIO pin as input # Check that this is the same pin you have your switch input plugged into! GPIO.setup(15, GPIO.IN) # Set initial state previousstate = GPIO.input(15) # Main loop while True: # Check that this is the same pin you have your switch input plugged into! mybutton = GPIO.input(15) if mybutton != previousstate: if mybutton == True: print "Door opened" res = p.push("My Raspberry Pi", 'House Warning','Door opened', batch_mode=False) else: print "Door closed" res = p.push("My Raspberry Pi", 'House Warning','Door closed', batch_mode=False) previousstate = mybutton # Print result if you like # pprint(res) time.sleep(.2)Nothing happens when i run python ./1.py
Its like its loading. But i guess i should ask on a raspberry forum for that matter :)