Raspberry pi Controlling DC Motor

l293d schematic

In this video i will show you how to Control DC Motor using Raspberry pi.

Python Code to Control DC Motor:

import sys
import time
import RPi.GPIO as gpio
gpio.setwarnings(False)
gpio.setmode(gpio.BOARD)
gpio.setup(7,gpio.OUT)
gpio.output(7,1)
gpio.setup(8,gpio.OUT)
gpio.setup(10,gpio.OUT)
try:
    while True:
        gpio.output(8,1)
        gpio.output(10,0)
        time.sleep(5)
        gpio.output(8,0)
        gpio.output(10,1)
        time.sleep(5)
        gpio.output(8,0)
        gpio.output(10,0)
        time.sleep(3)
except KeyboardInterrupt:
    gpio.cleanup()
    sys.exit()

Plz Share Share on FacebookShare on Google+Share on LinkedInTweet about this on TwitterEmail this to someoneShare on RedditShare on TumblrDigg thisBuffer this pagePrint this pagePin on PinterestShare on StumbleUponFlattr the author
Bookmark the permalink.

4 Comments

  1. HI Hackaholic team,

    Thanks for the wonderful tutorial

    can you please share the schematic diagram for connecting 4 dc motor using L293d Module with raspberry pi. I am making a project on toy car.

    Thanks

  2. HI Hackaholic team,

    can you please share the schematic diagram for connecting 4 dc motor using L293d Module with raspberry pi. I am making a project on toy car.

    Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *