This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| GPIO.setmode(GPIO.BCM) #sets the GPIO numering mode | |
| GPIO.setup(2,GPIO.OUT) | |
| while True: | |
| time.sleep(3) | |
| GPIO.output(2,GPIO.LOW) #sets the pin2 to provide 0V | |
| print 'LED should be OFF' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| # to use GPIO number not the pin physical number | |
| GPIO.setmode(GPIO.BCM) | |
| """ | |
| or to use the phisical pin numbers (1-40) instead of GPIO number | |
| GPIO.setmode(GPIO.BOARD) | |
| """ | |
| # setting up pins as I/O | |
| GPIO.setup(3, GPIO.IN) #sets GPIO3 as INPUT |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import RPi.GPIO as GPIO | |
| import time | |
| sensor = 24 #your GPIO on RPI | |
| GPIO.setmode(GPIO.BCM) | |
| GPIO.setup(sensor, GPIO.IN, GPIO.PUD_DOWN) | |
| current_state = False | |
| while True: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os | |
| import time | |
| import urllib | |
| import re | |
| import pickle | |
| #read file containing IPs and pass the set | |
| def readfile(): | |
| yourdevices = set() | |
| if not os.path.exists('test1.p'): #corrected |