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

Dsc05679 xxk38knz8i
Salman Faris

Learning By Doing.

Contact

Replications

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

Give feedback

Comments

Similar projects you might like

Using Android Phone as Raspberry Pi's Display
Easy
  • 339
  • 6

Full instructions

Using Android Phone as Raspberry Pi's display via SSH through VNC Viewer.

Controlling Raspberry Pi's Terminal Using Android Phone
Easy
  • 591
  • 8

Full instructions

Controlling the terminal window of the Raspberry Pi 3 using Android Phone via SSH.

PIR Motion Sensor with Raspberry Pi
Easy
  • 530
  • 10

Protip

Quick project to interface PIR sensor to Raspberry Pi.

SMART HOME SECURITY SYSTEM
Easy
  • 2,111
  • 16

Full instructions

Detects intrusion and notifies house owner. The owner remotely watches the house and if any theft is suspected will turn on the buzzer.

Boost Your Google Home With Prota OS for RPi
Easy
  • 1,993
  • 8

Full instructions

Extend your Google Home features to smart light, smart speakers, smart cam and smart appliances with those DIY tricks based on Raspberry Pi.

Simple Room Monitoring Project Using Raspberry Pi + Cayenne
Easy
  • 326
  • 3

It's IoT build night at Hexlab Makerspace! Tonight we are building a simple room monitoring device.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login
Feedback