Skip to content

Latest commit

 

History

History
67 lines (59 loc) · 3.38 KB

README.md

File metadata and controls

67 lines (59 loc) · 3.38 KB

IoTProject

Using NUCLEOF401RE board as a GameController on an online game Angry Gran Runner!

Abstract

In recent years, the use of sensors as an IoT device to detect user inputs or sense something has grown drastically. People use sensors to detect motion of the users(while playing a game) or even give some directions to the sensors itself so that its coordinates change. This not only makes the gameplay more exciting but also gives it a unique feature. The sensor board used in the project is X-NUCLEO-IKS01A2 that is attached to the NUCLEO-F401RE which is then connected to the PC using a USB cable. The board can have multiple ways to detect the changes in its direction. The one movement that I have used in my project is the rise detection. WHenever the Y-axes of the board change its coordinates it triggers a print statement of “u” denoting up. This “u” when detected by the python script, it will convert that message into command of “up button”. In the game whenever an obstacle needs to be hurdled, the board can be lifted which will trigger its WakeUpdetection Status, triggering it to print “u” message, and consequently up button is instantiated. So in my Angry Gran game, I can make the Granny jump, just based on the input fed into the sensor

Introduction

The project’s aim is to use 2 boards, the NUCLEO-F401RE and the Motion MEMS and environmental board which is the Nucleo expansion board, and send user input to the PC that is detected by the MEMS board. So basically, the data sent by the board should be simulated as an input to the PC.

Main challenges of implementation

The only challenge I faced during the implementation of the project was the latency issue. I managed to eliminate this issue by adding a wait() of 0.1 sec so that once the serial communication prints the letter “u” on the terminal it will wait for 0.1 sec and then listen to the mems_event again

Steps

1.Imports: First we need to add all the imports. Go to the command prompt and type pip install… and the names of the import that we require. ● Import serial ● Import time ● Import pyautogui 2. We start by connecting the Nucleo board to the PC using the USB cable and attach MEMS expansion board on top of the Nucleo board. 3. Import the .cpp code in the online MBED compiler. 4. Click on the compile button once the code is loaded with proper libraries. 5. This generates a bin file. 6. Next up, import the Python_WakeUp.py code into the IDLE. 7. Now Drag and drop the bin file into the external device that was generated by attaching the 2 boards to the PC. 8. Now, go to the Python_WakeUp.pya and click on Run and select run module. 9. After clicking on the run module, the next part is to try out the code. We do this by lifting up the board from its original position. 10.This would print a “u” in the python terminal. Once this is done, we can test the code by giving the same input to any online games such as the T-Rex jump.

Reference/Bibliography

https://os.mbed.com/teams/ST/code/6DOrientation_IKS01A2/diff/c81b6e8dec7e/X_NUCLEO_IKS01A2/Components/LSM6DSLSensor/LSM6DSLSensor.cpp/

Used this documentation for using the wake_up_detection function in my code which will require status as a parameter and triggers this value whenever the sensor board is lifted.

https://www.crazygames.com/game/angry-gran-run-russia

Used this link to test the up event whenever the board is lifted, the Angry gran jumps.