Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import RPi.GPIO as GPIO
- import time
- import xml.etree.cElementTree as ET,logging
- from simple_salesforce import Salesforce
- logging.captureWarnings(True)
- GPIO.setmode(GPIO.BOARD)
- print ">> The Program Is Trying To Login Into Salesforce.com. Please Wait..."
- sf = Salesforce(username='INSERT YOUR USRENAME', password='INSERT YOUR PASSWORD', security_token='INSERT YOUR SECURITY TOKEN')
- GPIO.setup(5, GPIO.OUT)
- GPIO.setup(11, GPIO.OUT)
- GPIO.setup(21, GPIO.OUT)
- for x in range(0,10):
- toggle = sf.query("SELECT Toggle__c FROM Raspi_ctrl__c WHERE Name='N-0002'")
- records=toggle["records"]
- temp = records[0]
- if temp["Toggle__c"] == "0":
- GPIO.output(5, True)
- time.sleep(3)
- GPIO.output(5, False)
- time.sleep(2)
- if temp["Toggle__c"] == "1":
- GPIO.output(11, True)
- time.sleep(2)
- GPIO.output(11, False)
- time.sleep(1)
- if temp["Toggle__c"] == "2":
- GPIO.output(21, True)
- time.sleep(2)
- GPIO.output(21, False)
- time.sleep(2)
- print (temp["Toggle__c"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement