Things used in this project

Schematics

H-Bridge
Circuit to drive the motor that taps on the screen
AFUi5he47SPfEaF7MoD7.sch

Code

Gaming BotPython
The code is written in python and runs on a Raspberry Pi. It needs openCV packages to be installed.
import RPi.GPIO as io
import cv2

cap=cv2.VideoCapture(0)
cv2.namedWindow("B & W")



io.setmode(io.BOARD)
io.setup(11,io.OUT)
io.setup(12,io.OUT)

def tap():
    io.output(12,io.LOW)
    io.output(11,io.HIGH)
    cv2.waitKey(150)
    io.output(11,io.LOW)
    io.output(12,io.HIGH)
    k=cv2.waitKey(50)
    io.output(12,io.LOW)


while cap.isOpened():
    ret,frame=cap.read()
    #bw=cv2.cvtColor(frame,cv2.COLOR_BGR2GRAY)
    roi=frame[300:317,237:262]
    bw = cv2.cvtColor(roi,cv2.COLOR_BGR2GRAY)

    ret,bw=cv2.threshold(bw,170,255,cv2.THRESH_BINARY)
    k=0
    for i in range(0,17):
        for j in range(0,25):
            if(bw.item(i,j)==255):
                k=k+1
    print k
    
    #cv2.imshow("Frame",frame)
    #cv2.imshow("B & W",bw)
	
    if k<420:
	print("tap")
        tap()
	ret,frame=cap.read()
        ret,frame=cap.read()
        ret,frame=cap.read()

    if cv2.waitKey(1) & 0xFF==27:
        break

cap.release()
cv2.destroyAllWindows()



while False:
    io.output(12,io.LOW)
    io.output(11,io.HIGH)
    k=cv2.waitKey(50)
    if k==27:
        break
    io.output(11,io.LOW)
    io.output(12,io.HIGH)
    k=cv2.waitKey(50)
    if k==27:
        break

Credits

My mijlstzyxz
Ankur Deka

I love to make and break !

Contact

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

Face Detection Using OpenCV With Raspberry Pi
Intermediate
  • 3,551
  • 33

Protip

In this project, we are going to detect faces using OpenCV with Raspberry Pi.

Creating an IoT Server with Home Assistant and MQTT
Intermediate
  • 3,908
  • 22

Protip

This guide will help you set up Home Assistant. Access it from any web browser and automations.

Home Automation Using Wiscore and OpenHab
Intermediate
  • 385
  • 3

Protip

This project will help you setup your very own Alexa controlled Home Appliances using the wonderful Wiscore Module from RAK Wireless.

Automated GPS Controlled Photo Taker
Intermediate
  • 1,826
  • 20

For this build, I put together a backpack to take pictures when I am close to places that I like; especially in London.

DIY Smart Assistant Speaker/Lamp (Google Home or Alexa)
Intermediate
  • 2,075
  • 5

Full instructions

DIY build using 3D printed enclosure and parts, a recycled Bluetooth speaker, a Raspberry Pi, and a Philips Hue light bulb.

Cat Door with Pet Recognition
Intermediate
  • 4,791
  • 22

Full instructions

Use object detection to let your cat in and out of the house with a motion-activated pet door.

ProjectsCommunitiesTopicsContestsLiveAppsBetaFree StoreBlogAdd projectSign up / Login