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

Chicken Coop Livestream
Easy
  • 2,773
  • 11

Full instructions

We have two chickens, and their coop is located at the back of the garden. I decided to build a Pi-based streaming device to check on them.

Test Your Internet Speed Using a Raspberry Pi + Ubidots
Easy
  • 413
  • 6

Protip

Use your Raspberry Pi to measure any internet connection speed with Ubidots.

Dataplicity “Custom Actions" for controlling RPi GPIOs
Easy
  • 46
  • 1

Protip

With this example you will control GPIOs on your Raspberry Pi from the Dataplicity Mobile app using "Custom Actions" feature.

Raspberry Pi Shutdown / Restart Button
Easy
  • 5,353
  • 20

Full instructions

Building an installation project? Shut down or reboot your project safely, without a keyboard or SSH!

DIY Raspberry Pi Indoor Outdoor Webcam
Easy
  • 1,626
  • 6

Full instructions

Ever want to monitor your home but don't want to buy a $100 1080p webcam? Well I did, and you can too!

Single Device to Control Many Arduinos with NRF24L01+ Sensor
Easy
  • 1,541
  • 9

Turns your fan on and off by sensing the temperature.

Sign up / LoginProjectsPlatformsTopicsContestsLiveAppsBetaFree StoreBlog