/ESP32_proj2

Primary LanguageJavaScript

ESP32_proj2

There are two parts to this project. The ESP32 code, which sends controller data to the computer via serial, and the Loading Simulator 2022 game itself, which interprets the controller data and responds to it.

Loading Simulator 2022 interface

Loading screen

Controller

PXL_20220310_053957084 PXL_20220310_054018956

How to run Loading Simulator 2022

To run Loading Simulator 2022, simply open "index.html" in a browser that supports web serial e.g. Google Chrome. The system accepts data in JSON format with 4 data fields so you can build your own custom controller:

{
  "b": Button value of 0 or 1,
  "x": Joystick X value from 0 to 4095,
  "y": Joystick Y value from 0 to 4095,
  "p": Potentiometer value from 0 to 4095
}

When you open Loading Simulator, click on the top left corner to open a list of serial ports. Once you select a port, the system can receive controller data.

Controls

Pressing the Button displays a random loading message. Moving the joystick up and down moves the loading bar up and down. Moving the joystick left and right increases the loading progress asymptotically towards 100%. Turning the potentiometer changes the loading bar "redness".

How to run ESP32 code:

The code to run is under the inputTester folder. The ESP32 code constantly sends sensor data via serial every 10ms. Pin number and connected components are as follows:

PXL_20220307_210900644

We are using the Arduino IDE. To enable IDE support for the ESP32, first open up Preferences and under "Additional Boards Manager URLs", add the following URL:

https://dl.espressif.com/dl/package_esp32_index.json

BoardsManagerURL

Then, go to "Tools/Board:/Board Manager" and install ESP32:

BoardsManager

Then, go to "Tools/Manage Libraries" and search for tft_eSPI. Install it.

ManageLibs

After that, go to "Tools/Board:" and select "TIGO T1".

BoardSelect

Now, simply connect your board and click upload.