ESP32 Arduino Obstacles is an exciting physics-based project designed for the ESP32-S3R2 microcontroller. This project utilizes TFT_eSPI library to render smooth, flicker-free animations using Sprites, ensuring a seamless graphical experience.
The main objective of this project is to simulate real-world physics, including gravity, obstacle detection, and avoidance, making it interactive and dynamic. The addition of a gyroscope makes it even more engaging, as movement can be influenced by external forces.
- ESP32-S3R2 microcontroller
- ESP32 Board Version: 2.0.12 (Ensure compatibility with your TFT display)
- TFT_eSPI LCD Library: v2.5.34
- Arduino IDE (Latest version recommended)
- Smooth Animation: Utilizes Sprites from the TFT_eSPI library to eliminate flickering.
- Physics Engine: Implements basic gravity and damping effects.
- Obstacle Detection & Avoidance: Objects interact dynamically within the set boundaries.
- Customizable Parameters: Users can modify object properties such as size, number, and texture.
- Gyroscope Integration: Adds an extra layer of interaction and realism.
The following parameters in the code allow customization of object properties:
const int maxObjects = 25; // Maximum number of objects
myObject objects[maxObjects]; // Array to store objects
int objSizeMin = 8;
int objSizeMax = 8;
int objTextureMin = 0;
int objTextureMax = 1;
float dampingFactor = 1; // Adjust as needed for damping effect
const float dampingFactorD = 0.90;
float mygravity = 0.0; // Initial gravity (turned off)
float gravityStartTime = 5000; // Time (in milliseconds) to turn on gravity
unsigned long gravityChangeInterval = 5000; // Time interval to change gravity direction
unsigned long lastGravityChangeTime = 0;
bool gravityEnabled = false;
unsigned long startTime = 0;
float gravityG = 0.5;
float boundaryRadius = 120.0 - 1.0;
int backgroundColor = TFT_BLACK;Users can modify these parameters to fine-tune the behavior of the physics simulation.
- Improved collision detection
- Additional object textures and behaviors
- Enhanced gyroscope-based interactions
- Touchscreen support (if applicable)
- Install Arduino IDE and configure ESP32 board version 2.0.12.
- Install the TFT_eSPI library (v2.5.34).
- Clone this repository and upload the code to your ESP32-S3R2 board.
- Customize the parameters in the code as needed.
- Enjoy the physics simulation!
This project is still in its early stages. Contributions, improvements, and suggestions are welcome!
This project is open-source under the MIT License.
Feel free to update this README as the project evolves!
