Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- PASTEBIN
- new paste
- API tools faq deals
- Guest User
- -
- Public Pastes
- Untitled0 sec ago
- Untitled1 sec ago
- UntitledPython | 11 sec ago
- Untitled18 sec ago
- UntitledPython | 24 sec ago
- Shy legit config26 sec ago
- Untitled36 sec ago
- Untitled36 sec ago
- daily pastebin goal
- 33%
- help support pastebin
- SHARE
- TWEET
- Untitled
- a guest Jul 21st, 2018 16 in 9 min
- Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- rawdownloadcloneembedreportprint Python 1.12 KB
- # -*- coding: utf-8 -*-
- #coder :- Salman Faris
- import sys
- import time
- import telepot
- import RPi.GPIO as GPIO
- #LED
- def on(pin):
- GPIO.output(pin,GPIO.HIGH)
- return
- def off(pin):
- GPIO.output(pin,GPIO.LOW)
- return
- # to use Raspberry Pi board pin numbers
- GPIO.setmode(GPIO.BCM)
- # set up GPIO output channel
- GPIO.setup(20, GPIO.OUT)
- def handle(msg):
- chat_id = msg['chat']['id']
- command = msg['text']
- print('Got command: %s' % command)
- if command == 'halo':
- bot.sendMessage(chat_id, "🔐 Welcome to GATEMAN_Bot 🔐")
- elif command == 'On':
- bot.sendMessage(chat_id, on(20))
- elif command =='Off':
- bot.sendMessage(chat_id, off(20))
- bot = telepot.Bot('606956685:AAEDJxdyi--cVYJ9ye-z7ChrGytjlVDKCcA')
- bot.deleteWebhook()
- bot.message_loop(handle)
- print('I am listening...')
- while 1:
- try:
- time.sleep(10)
- except KeyboardInterrupt:
- print('\n Program interrupted')
- GPIO.cleanup()
- exit()
- except:
- print('Other error or exception occured!')
- GPIO.cleanup()
- RAW Paste Data
- # -*- coding: utf-8 -*-
- #coder :- Salman Faris
- import sys
- import time
- import telepot
- import RPi.GPIO as GPIO
- #LED
- def on(pin):
- GPIO.output(pin,GPIO.HIGH)
- return
- def off(pin):
- GPIO.output(pin,GPIO.LOW)
- return
- # to use Raspberry Pi board pin numbers
- GPIO.setmode(GPIO.BCM)
- # set up GPIO output channel
- GPIO.setup(20, GPIO.OUT)
- def handle(msg):
- chat_id = msg['chat']['id']
- command = msg['text']
- print('Got command: %s' % command)
- if command == 'halo':
- bot.sendMessage(chat_id, "🔐 Welcome to GATEMAN_Bot 🔐")
- elif command == 'On': {
- bot.sendMessage(chat_id, "Enter Gateman key 🔑🔑")
- if command == 'mygate'{
- bot.sendMessage(chat_id, "Pintu terbuka 🔓🔓")
- bot.sendMessage(chat_id, on(20))
- }
- }
- elif command =='Off':{
- bot.sendMessage(chat_id, "Enter Gateman key 🔑🔑")
- if command == 'mygate'{
- bot.sendMessage(chat_id, "Pintu terbuka 🔓🔓")
- bot.sendMessage(chat_id, on(20))
- }
- bot.sendMessage(chat_id, off(20))
- bot.sendMessage(chat_id, "Pintu tertutup 🔒🔒")
- }
- bot = telepot.Bot('606956685:AAEDJxdyi--cVYJ9ye-z7ChrGytjlVDKCcA')
- bot.deleteWebhook()
- bot.message_loop(handle)
- print('I am listening...')
- while 1:
- try:
- time.sleep(10)
- except KeyboardInterrupt:
- print('\n Program interrupted')
- GPIO.cleanup()
- exit()
- except:
- print('Other error or exception occured!')
- GPIO.cleanup()
- create new paste / dealsnew! / api / scraping api / syntax languages / archive / faq / tools / night mode / go
- privacy statement / cookies policy / terms of service / security disclosure / dmca / contact
- By using Pastebin.com you agree to our cookies policy to enhance your experience.
- Site design & logo © 2018 Pastebin; user contributions (pastes) licensed under cc by-sa 3.0 -- Dedicated Server Hosting by Steadfast
- Top
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement