Experiment 5 MSK Raspberry Telegram
Experiment 5 MSK Raspberry Telegram
Raspberry Pi
Er. Manoj S. Kavedia
www.kaizenfuturetech.com
www.kavediasir.yolasite.com
9324258878 / 8329988738
Raspberry Pi Pin Out
About Telegram Bot
• On 24 June, 2015, Telegram published the Bot
API, enabling machines to talk Telegram.
chat_id=""
#LED
def on(pin):
GPIO.output(pin,GPIO.HIGH)
#bot.sendMessage (chat_id, "device On")
return
def off(pin):
GPIO.output(pin,GPIO.LOW)
#bot.sendMessage (chat_id, "device Off")
return
Python Code
# to use Raspberry Pi board pin numbers
GPIO.setmode(GPIO.BOARD)
def handle(msg):
chat_id = msg['chat']['id']
command = msg['text']
if command == 'on':
bot.sendMessage(chat_id, on(3))
while 1:
time.sleep(10)
Run Child Bot and Give Command
Er. Manoj S. Kavedia