Things used in this project

Hardware components:
Pi 3 02
Raspberry Pi 3 Model B
×1
09590 01
LED (generic)
×1
11026 02
Jumper wires (generic)
×1
12002 04
Breadboard (generic)
×1

Schematics

Conncection between pi and LED
Simpl iza7zc8bch

Code

telegrambot.pyPython
#coder :- Salman Faris

import sys
import time
import random
import datetime
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.BOARD)
# set up GPIO output channel
GPIO.setup(11, GPIO.OUT)

def handle(msg):
    chat_id = msg['chat']['id']
    command = msg['text']

    print 'Got command: %s' % command

    if command == 'on':
       bot.sendMessage(chat_id, on(11))
    elif command =='off':
       bot.sendMessage(chat_id, off(11))

bot = telepot.Bot('Bot Token')
bot.message_loop(handle)
print 'I am listening...'

while 1:
     time.sleep(10)

Credits

10565075 614694575316976 4077841016889052230 n
Salman Faris

Learning By Doing.

Replications

Love this project? Think it could be improved? Tell us what you think!

Give feedback

Comments

Similar projects you might like

DIY Smart Home Doorbell 2.0 (works with Alexa)
Easy
  • 2,105
  • 14

Full instructions

Build your own DIY smart home doorbell for cheap, get notified when your guest knock at your door and remotely open by voice command

DIY Self-monitored Smart Home for Vacation Time
Easy
  • 2,174
  • 13

Full instructions

Automate your house to have a peaceful mind on vacation! Monitor remotely and stay updated through smartphone notifications.

Control LED Using Raspberry Pi GPIO
Easy
  • 809
  • 2

Full instructions

This is a basic project to connect an LED to RPi GPIO and control using a python script.

DIY Smart Car System
Easy
  • 2,206
  • 12

Full instructions

Transform your car in a smart car with those easy tricks for only $50-$70. Increase your car's safety, integrate a connected dash cam & more

Uploading PiCamera Images to Azure
Easy
  • 951
  • 10

Protip

Use PiCamera to take pictures and upload them to Microsoft Azure.

New Era of Gaming on Raspberry Pi
Easy
  • 2,096
  • 8

Protip

Learn how to play Counter Strike and Diablo II on Raspberry Pi with ExaGear Desktop 2.0 3D Acceleration Update

ProjectsCommunitiesContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Respect project
Feedback