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

l <3 Computers .

Replications

Did you replicate this project? Share it!

I made one

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

Give feedback

Comments

Similar projects you might like

Read/Write Data from/to USB Thumb Drive on Windows IoT Core
Easy
  • 766
  • 12

Protip

Work around universal apps that block you from reading/writing data files.

How to Get Terminal to Raspberry Via SSL from Anywhere
Easy
  • 5,251
  • 21

Protip

Sometimes we want terminal capabilities from outside the bounds our network. That is, terminal to web with no port forwarding.

Toggle an LED with Real HTTPS to Raspberry PI - no Public IP
Easy
  • 5,663
  • 18

Protip

Simple, easy & free way to expose Raspberry Pi to the Web w/a real public SSL certificate + e2e encryption. No public IP/port forwarding.

Particle + Raspberry Pi
Easy
  • 3,179
  • 19

Protip

The world's favorite low-cost computer now connects to the world's most popular IoT platform.

Windows 10 Core IoT Magic Mirror
Easy
  • 7,921
  • 44

Work in progress

A simple solution for a Magic Mirror using only HTML and some Javascript.

Camera stream from device to PC
Easy
  • 1,612
  • 11

Protip

I use a proxy web application hosted inside Azure to transfer image data from my robot camera to the remote control app.

ProjectsCommunitiesContestsLiveJobsFree StoreBlogAdd projectSign up / Login
Respect project