This project is basically an attempt to use python to control devices such as PCDesktop and mobile phones with an arduino board. I am not much experienced in using python with arduino, so as an attempt to understand this combo, I tried this project. I was inspired by the Dino Game project by Jalaal_Mansoori, link below:
WORKING:This project uses an Infrared proximity sensor as thetouchlesstrigger switch for the Dino's jump(Although most other makers use LDRs for this job).When the IR proximity sensor senses an obstacle it sends this data to the Arduino Micro controller.It then transmits this data to the PC via the USB cable. The command "up" is sent to the python code running in the background. The python code reads the "up" command and then the dinooftheDinoGame on the chrome page jumps by the message sent("up") by the python code to the window.
PYTHON REQUIREMENTS:I used Spyder present in the Anaconda Navigator. The python application will also do the job.
The python code requires a library called the "pyautogui" which reads the "up" commands and acts accordingly. The package can be downloaded by typing in command prompt
pipinstallpyautogui
Also "pyserial" package is needed for establishing serial communication with Arduino.
This fulfills the requirement of python libraries.
The game can be played by using two programs written,in 2 different languages running in harmony. One on the Arduino board(C++) and the other on the PC(Python).The Arduino code needs to be uploaded first to the Arduino board and then executing the python program in the background on the PC while simultaneously playing the game (that's too much of work to do XD ). But don't worry it's super easy. After uploading Arduino sketch keep the Dino game waiting to start on chrome then execute python code;and it's done!!. Then with the first swipe in front of the sensor, the Dino starts running. After this each time when you swipe, the Dino jumps on the screen simultaneously.So, grab the Arduino Board and start playing !!!!
PROJECT TEST RUN VIDEO :)Click on the Drive link below to view the project execution.Cheers!!!
https://drive.google.com/file/d/1JhNbrqPAMd5ALrHFTAFoj8uWhRGA4q7p/view?usp=sharing
Comments