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

Replications

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

Give feedback

Comments

Similar projects you might like

Pre-Bedtime Environment Analysis
Easy
  • 408
  • 6

Work in progress

Define the optimum environment for sleep by applying ML to sensor data.

DIY smart home doorbell for less than $40!
Easy
  • 2,035
  • 19

Full instructions

Make a smart doorbell that notifies you when someone is at the door w/ snapshot and let you open the door remotely, all for less than $40!

DIY Smart Power Sockets
Easy
  • 1,182
  • 6

Full instructions

Automate all your lights at home for a fraction of the usual cost with this simple project (5 lights for less than $60).

Digital output management with CoAP
Easy
  • 392
  • 8

Full instructions

The X.IP5 slip-radio manages the X.IP5-web-demo: turning LEDs on/off through CoAP.

Raspberry Pi Compute Module 3 Unboxing
Easy
  • 745
  • 6

Work in progress

Just got my Raspberry CM3 and CM3L and Development kit. Didn't unbox the CM1 kit yet, but this time let's see what I can build next?

Security System w/ Motion Sensor, Camera, Wia, Raspberry Pi
Easy
  • 1,872
  • 13

Full instructions

Build your own security system, using the Wia Python SDK, a Motion sensor module, a camera module, and a Raspberry Pi.

ProjectsCommunitiesContestsLiveJobsBetaFree StoreBlogAdd projectSign up / Login
Respect project