Exemplo n.º 1
0
 def __init__(self):
     print('init')
     GPIO.setup("XIO-P2", GPIO.OUT, initial=1)
     GPIO.setup("XIO-P3", GPIO.OUT, initial=1)
     GPIO.setup("XIO-P4", GPIO.OUT, initial=1)
     GPIO.setup("XIO-P5", GPIO.OUT, initial=1)
     GPIO.setwarnings(False)
Exemplo n.º 2
0
Arquivo: Lcd.py Projeto: gcupini/TINY
def lcd_init(a_RS, a_E, a_D4, a_D5, a_D6, a_D7, a_Back):
    global LCD_RS
    global LCD_E
    global LCD_D4
    global LCD_D5
    global LCD_D6
    global LCD_D7
    global LCD_Back
    LCD_RS = a_RS
    LCD_E = a_E
    LCD_D4 = a_D4
    LCD_D5 = a_D5
    LCD_D6 = a_D6
    LCD_D7 = a_D7
    LCD_Back = a_Back
    #  GPIO.toggle_debug()
    GPIO.setmode(GPIO.BOARD)
    GPIO.setwarnings(False)

    # Main program block
    GPIO.setup(LCD_RS, GPIO.OUT)  # RS
    GPIO.setup(LCD_E, GPIO.OUT)  # E
    GPIO.setup(LCD_D4, GPIO.OUT)  # DB4
    GPIO.setup(LCD_D5, GPIO.OUT)  # DB5
    GPIO.setup(LCD_D6, GPIO.OUT)  # DB6
    GPIO.setup(LCD_D7, GPIO.OUT)  # DB7
    GPIO.setup(LCD_Back, GPIO.OUT)  # Backlight enable
    # Initialise display
    lcd_byte(0x33, LCD_CMD)  # 110011 Initialise
    lcd_byte(0x32, LCD_CMD)  # 110010 Initialise
    lcd_byte(0x06, LCD_CMD)  # 000110 Cursor move direction
    lcd_byte(0x0C, LCD_CMD)  # 001100 Display On,Cursor Off, Blink Off
    lcd_byte(0x28, LCD_CMD)  # 101000 Data length, number of lines, font size
    lcd_byte(0x01, LCD_CMD)  # 000001 Clear display
    time.sleep(E_DELAY)
Exemplo n.º 3
0
	def setup(self):
		GPIO.setwarnings(False)
		GPIO.cleanup()
		GPIO.setup(self.__pconfig['button'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
		GPIO.setup(self.__pconfig['rec_light'], GPIO.OUT) # lights'], GPIO.OUT)
		GPIO.setup(self.__pconfig['plb_light'], GPIO.OUT) # lights'], GPIO.OUT)
		GPIO.output(self.__pconfig['rec_light'], GPIO.LOW)
		GPIO.output(self.__pconfig['plb_light'], GPIO.LOW)
Exemplo n.º 4
0
    def setup_gpio(self):

        GPIO.setwarnings(False)
        try:
            GPIO.setmode(GPIO.BOARD)
        except AttributeError:
            pass
        GPIO.setup(self.pin, GPIO.OUT)
        GPIO.output(self.pin, True)
Exemplo n.º 5
0
 def setup(self):
     GPIO.setwarnings(False)
     GPIO.cleanup()
     GPIO.setup(self.__pconfig['button'], GPIO.IN, pull_up_down=GPIO.PUD_UP)
     GPIO.setup(self.__pconfig['rec_light'],
                GPIO.OUT)  # lights'], GPIO.OUT)
     GPIO.setup(self.__pconfig['plb_light'],
                GPIO.OUT)  # lights'], GPIO.OUT)
     GPIO.output(self.__pconfig['rec_light'], GPIO.LOW)
     GPIO.output(self.__pconfig['plb_light'], GPIO.LOW)
Exemplo n.º 6
0
 def __init__(self, pinA, pinB, button, callback):
     self.pinA = pinA
     self.pinB = pinB
     self.button = button
     self.callback = callback
     GPIO.setmode(GPIO.BCM)
     GPIO.setwarnings(False)
     GPIO.setup(self.pinA, GPIO.IN, pull_up_down=GPIO.PUD_UP)
     GPIO.setup(self.pinB, GPIO.IN, pull_up_down=GPIO.PUD_UP)
     GPIO.setup(self.button, GPIO.IN, pull_up_down=GPIO.PUD_UP)
     GPIO.add_event_detect(self.pinA, GPIO.FALLING, callback=self.switch_event)
     GPIO.add_event_detect(self.pinB, GPIO.FALLING, callback=self.switch_event)
     GPIO.add_event_detect(self.button, GPIO.BOTH, callback=self.button_event, bouncetime=200)
Exemplo n.º 7
0
config = SafeConfigParser()
config.read(sys.argv[1])
sensor_pin = "XIO-P1"
#sensor_pin = config.getint('main', 'SENSOR_PIN')
begin_seconds = config.getint('main', 'SECONDS_TO_START')
end_seconds = config.getint('main', 'SECONDS_TO_END')
pushbullet_api_key = config.get('pushbullet', 'API_KEY')
pushbullet_api_key2 = config.get('pushbullet', 'API_KEY2')
start_message = config.get('main', 'START_MESSAGE')
end_message = config.get('main', 'END_MESSAGE')
twitter_api_key = config.get('twitter', 'api_key')
twitter_api_secret = config.get('twitter', 'api_secret')
twitter_access_token = config.get('twitter', 'access_token')
twitter_access_token_secret = config.get('twitter', 'access_token_secret')
#slack_api_token = config.get('slack', 'api_token')
#slack_webhook = config.get('slack','webhook_url')
iftt_maker_channel_event = config.get('iftt', 'maker_channel_event')
iftt_maker_channel_key = config.get('iftt', 'maker_channel_key')

send_alert(config.get('main', 'BOOT_MESSAGE'))

GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
GPIO.setup(sensor_pin, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.add_event_detect(sensor_pin, GPIO.RISING)
GPIO.add_event_callback(sensor_pin, vibrated)

print 'Running config file {} monitoring GPIO pin {}'\
      .format(sys.argv[1], str(sensor_pin))
threading.Timer(1, heartbeat).start()
Exemplo n.º 8
0
    def setup(self):
        GPIO.setwarnings(False)
        GPIO.cleanup()

        super(ChipPlatform, self).setup()
Exemplo n.º 9
0
	def setup(self):
		GPIO.setwarnings(False)
		GPIO.cleanup()

		super(ChipPlatform, self).setup()