Category: Coding

  • AvantDigitalRead: Elevate Your ESP32 Projects with Smart Input Handling

    AvantDigitalRead: Elevate Your ESP32 Projects with Smart Input Handling

    We are excited to unveil the latest addition to the AvantMaker family of ESP32 Arduino libraries: AvantDigitalRead, a powerful and versatile library designed to revolutionize digital input management on the ESP32. Crafted with makers, hobbyists, and developers in mind, AvantDigitalRead enhances the standard Arduino digitalRead functionality, offering advanced features like multi-pin management, event detection, and sophisticated gesture recognition.

    What’s AvantDigitalRead All About?

    AvantDigitalRead is a comprehensive solution for managing digital inputs on the ESP32. Whether you’re building interactive user interfaces, handling sensor data, or creating complex IoT devices, this library simplifies the process with a clean, intuitive interface. It takes the hassle out of debouncing, event handling, and gesture detection, allowing you to focus on bringing your creative projects to life.

    Key features include:

    • Multi-pin Management: Easily add or remove pins for unified control.
    • Built-in Debouncing: Customizable debounce times for reliable input readings.
    • Rich Event Detection: Detect state changes, rising edges, and falling edges with ease.
    • Advanced Button Gestures: Recognize single-press, double-press, and long-press events with configurable timings.
    • Non-Blocking Design: Keep your loop() clean and responsive.
    • Unified Callback Format: Simplify your code with consistent event handling.

    This library is perfect for a wide range of applications, including:

    • Interactive Interfaces: Create responsive buttons and switches for user controls.
    • Sensor Integration: Reliably read data from sensors in IoT projects.
    • Smart Devices: Build intuitive controls for home automation and robotics.

    Why We Built AvantDigitalRead

    At AvantMaker, our mission is to empower the maker community with tools that are both powerful and accessible. We recognized that managing digital inputs on the ESP32 often involves repetitive, error-prone code for debouncing and event detection. AvantDigitalRead abstracts away this complexity, providing a robust, non-blocking solution that ensures stable input handling and simplifies gesture recognition.

    This library is designed to be a cornerstone for our upcoming ESP32 tutorials, particularly those integrating hardware control with IoT and AI applications. With AvantDigitalRead, you can build reliable, responsive projects with confidence, freeing you to experiment and innovate.

    A Glimpse of What You Can Do

    Imagine creating a smart device that detects a single button press to toggle a light, a double press to adjust brightness, or a long press to activate a special mode. With AvantDigitalRead, these complex interactions become simple and reliable.

    Here’s a quick example to demonstrate its power:

    
    #include "AvantDigitalRead.h"
    
    // Define the pin to monitor
    #define BUTTON_PIN 5 
    
    // Create an instance of AvantDigitalRead
    AvantDigitalRead pinManager;
    
    void setup() {
      // Initialize serial communication
      Serial.begin(115200);
      while (!Serial) {
        ; // Wait for serial port to connect
      }
      
      // Print welcome message
      Serial.println("BasicButtonMonitor Example Starting...");
      Serial.print("Monitoring pin for button presses: ");
      Serial.println(BUTTON_PIN);
      Serial.println("Press the button to see single/double/long press notifications.");
      Serial.println("----------------------------------------");
      
      // Initialize the pin to monitor
      if (pinManager.addPin(BUTTON_PIN, INPUT_PULLUP)) {
        Serial.println("Pin initialized successfully");
      } else {
        Serial.println("Failed to initialize pin");
        while (1) {
          delay(100); // Halt execution if pin initialization fails
        }
      }
      
      // Set debounce time to prevent false triggers (30 milliseconds)
      pinManager.setDebounceTime(BUTTON_PIN, 30);
      
      // Set click parameters (optional, using default values here)
      // pinManager.setClickParameters(BUTTON_PIN, 50, 300, 500);
      // Parameters: minPressMs, maxPressMs, maxIntervalMs
      
      // Set long press duration (optional, default is 1000ms)
      // pinManager.setLongPressDuration(BUTTON_PIN, 1000);
      
      // Register the callback functions for single, double, and long press events
      pinManager.onSinglePress(BUTTON_PIN, singlePressCallback);
      pinManager.onDoublePress(BUTTON_PIN, doublePressCallback);
      pinManager.onLongPress(BUTTON_PIN, longPressCallback);
      
      Serial.println("Ready for input.");
      Serial.println("----------------------------------------");
    }
    
    void loop() {
      // Must call update() regularly to process events
      pinManager.update();
      
      // Small delay to prevent excessive CPU usage
      delay(10);
    }
    
    
    // Callback function for single press events
    void singlePressCallback(int pin, PinState newState, PinState oldState, 
                            EventType event, unsigned long timestamp) {
      // Print pin information
      Serial.print("Pin ");
      Serial.print(pin);
      Serial.print(" SINGLE PRESS detected: ");
      Serial.print(oldState);
      Serial.print(" -> ");
      Serial.print(newState);
      
      // Print timestamp
      Serial.print(" at ");
      Serial.print(timestamp);
      Serial.println(" ms");
      
      // Additional information
      Serial.println("  Event: Button pressed and released once");
    }
    
    // Callback function for double press events
    void doublePressCallback(int pin, PinState newState, PinState oldState, 
                            EventType event, unsigned long timestamp) {
      // Print pin information
      Serial.print("Pin ");
      Serial.print(pin);
      Serial.print(" DOUBLE PRESS detected: ");
      Serial.print(oldState);
      Serial.print(" -> ");
      Serial.print(newState);
      
      // Print timestamp
      Serial.print(" at ");
      Serial.print(timestamp);
      Serial.println(" ms");
      
      // Additional information
      Serial.println("  Event: Button pressed and released twice in quick succession");
    }
    
    // Callback function for long press events
    void longPressCallback(int pin, PinState newState, PinState oldState, 
                          EventType event, unsigned long timestamp) {
      // Print pin information
      Serial.print("Pin ");
      Serial.print(pin);
      Serial.print(" LONG PRESS detected: ");
      Serial.print(oldState);
      Serial.print(" -> ");
      Serial.print(newState);
      
      // Print timestamp
      Serial.print(" at ");
      Serial.print(timestamp);
      Serial.println(" ms");
      
      // Additional information
      Serial.println("  Event: Button held down for extended duration");
    }

    What’s Next for AvantDigitalRead?

    This is just the beginning! AvantDigitalRead will play a key role in our upcoming ESP32 Arduino tutorials, where we’ll showcase its integration with AI-powered projects and IoT applications.

    Our goal is to make AvantDigitalRead the go-to library for ESP32 digital input management, empowering makers to create more intuitive and responsive projects.

    Get Started Today!

    Ready to streamline your digital input code and unlock new possibilities? Head over to the AvantDigitalRead GitHub Repository to download the library, explore the examples, and dive into the full API documentation.

    You can install AvantDigitalRead via the Arduino IDE Library Manager, or download the ZIP file for manual installation. Check out the “Quick Start” section in the README for step-by-step instructions.

    We encourage you to try AvantDigitalRead in your projects, experiment with its features, and share your feedback. Your input helps us improve and grow—feel free to open issues, suggest features, or contribute to the project.

    Explore our growing collection of libraries and tutorials at the AvantMaker GitHub or dive into our resources at AvantMaker.com.

    Happy Making! 🛠️✨

  • Announcing AvantPinSet: The Ultimate ESP32 Pin Control Library for Makers

    Announcing AvantPinSet: The Ultimate ESP32 Pin Control Library for Makers

    We are thrilled to introduce the newest addition to the AvantMaker family of libraries: AvantPinSet, a powerful and intuitive Arduino library designed to simplify GPIO pin management for the ESP32. AvantPinSet is engineered to make your projects more responsive, dynamic, and easier to code.

    What’s AvantPinSet All About?

    AvantPinSet is a comprehensive solution for managing multiple ESP32 pins with a wide range of functionalities. It provides a clean, unified interface for digital I/O, PWM control, and sophisticated timed and fading operations. Say goodbye to complex millis() logic and tangled code—AvantPinSet handles the low-level details so you can focus on bringing your creative ideas to life.

    This library is perfect for a variety of applications, including:

    • Home Automation: Effortlessly manage relays, sensors, and switches.
    • Custom Lighting: Create smooth, elegant PWM fading effects for LEDs.
    • Robotics: Control motors and actuators with precision.

    Why We Built AvantPinSet

    At AvantMaker, our mission is to empower the maker community with tools that are both powerful and easy to use. We noticed that many ESP32 projects involve repetitive and often complex code for managing pin states, especially for timed events. We created AvantPinSet to abstract away that complexity, providing a robust, non-blocking solution that keeps your loop() clean and your projects running smoothly.

    This library is designed to be a foundational tool for many of our upcoming tutorials, especially those that integrate hardware control with AI and IoT applications. With AvantPinSet, you can build a solid, reliable foundation for your projects, allowing you to experiment and innovate with confidence.

    A Glimpse of What You Can Do

    Imagine creating a smart home device that turns on a light, waits a few seconds, and then gently fades it out. Or a robot that moves a servo, holds its position, and then returns to its starting point. With AvantPinSet, these complex sequences become simple, readable, and reliable.

    Here’s a quick example to show you just how easy it is:

    #include <AvantPinSet.h>
    
    // Define the pins you want to manage
    int myPinList[] = {2, 4, 27};
    const int numPins = 3;
    
    // Create an instance of the library
    AvantPinSet myPins(myPinList, numPins);
    
    // Optional callback for when timed actions complete
    void actionComplete(int pinNum) {
      Serial.printf("Action on pin %d has completed!\n", pinNum);
    }
    
    void setup() {
      Serial.begin(115200);
    
      // Set pin 2 HIGH immediately
      myPins.digitalSet(2, HIGH);
    
      // Set pin 4 HIGH, then revert to LOW after 3 seconds
      myPins.digitalSetTime(4, HIGH, 3, actionComplete);
    
      // Set pin 27 to 50% PWM, hold for 5 seconds, then fade to 0
      myPins.pwmFadeTime(27, 128, 0, 5, actionComplete);
    }
    
    void loop() {
      // This single line handles all the magic!
      myPins.update();
    }

    What’s Next for AvantPinSet?

    This is just the beginning! We have big plans for AvantPinSet. We will be showcasing Artificial Intelligence-powered projects that leverage this library for sophisticated hardware control.

    Furthermore, AvantPinSet will become a core component in the projects featured in our ESP32 Arduino Tutorials, providing a practical and powerful tool for learners. We are committed to expanding its capabilities with more advanced features, including complex sequences and tighter integration with our other libraries. Our goal is to make AvantPinSet the go-to library for ESP32 pin management.

    Get Started Today!

    Ready to simplify your pin control code and unlock new possibilities? Head over to the AvantPinSet GitHub Repository to download the library, explore the examples, and read the full API documentation.

    We encourage you to try it out in your projects, experiment with its features, and see how much easier your hardware projects can be. Your feedback is invaluable, so feel free to open issues, suggest features, or contribute to the project.

    Explore our growing collection of libraries and tutorials at the AvantMaker GitHub or dive into our resources at AvantMaker.com.

    Happy Making! 🛠️✨

  • AvantMaker’s AvantLumi: Light Up Your ESP32 and Arduino Projects with Stunning LED Control!

    AvantMaker’s AvantLumi: Light Up Your ESP32 and Arduino Projects with Stunning LED Control!

    Hey Makers, Get Ready to Shine!

    We’re absolutely thrilled to unveil the latest gem in the AvantMaker lineup: AvantLumi, a dazzling Arduino library crafted to elevate your LED strip projects on ESP32, Arduino, and compatible microcontrollers!

    What’s AvantLumi All About?

    Built on the robust FastLED library, AvantLumi is your ultimate tool for creating breathtaking LED effects with a user-friendly, feature-rich interface. From colorful palettes to smooth fade animations, this library is designed to ignite your creativity in IoT and DIY projects. It’s perfect for both beginners and experienced makers, offering a seamless way to bring your lighting visions to life.

    Why We Built AvantLumi

    At AvantMaker, we’re passionate about empowering makers to explore the full potential of microcontrollers like the ESP32. We created AvantLumi to make LED control accessible, powerful, and fun, especially for those diving into our upcoming tutorials on implementing ESP32 in AI applications.

    This library is designed to help users easily build projects and practice their learning, providing a practical and engaging way to master LED control while experimenting with AI-driven IoT solutions. With AvantLumi, you can focus on creating and learning, not wrestling with complex code.

    A Glimpse of What You Can Do

    Picture a holiday display cycling through festive Christmas and Halloween palettes, a music-reactive light show pulsing to the beat, or an AI-driven ambient setup that shifts colors based on real-time data. With AvantLumi, these ideas are just a few lines of code away! Here’s a quick example to kick things off:

    #include "AvantLumi.h"
    
    #define DATA_PIN 2
    #define NUM_LEDS 60
    
    AvantLumi lumi(DATA_PIN, NUM_LEDS);
    
    void setup() {
      lumi.begin();
      lumi.setSwitch(true);       // Turn on LEDs
      lumi.setBright(3);         // Medium brightness
      lumi.setPalette("rainbow"); // Rainbow palette
      lumi.setFade(true);        // Enable fade effects
    }
    
    void loop() {
      lumi.update(); // Keep the magic glowing!
    }

    What’s Next for AvantLumi?

    This is just the start! We’re already working on exciting updates, including new palettes, enhanced effects, and deeper integration with our AI-focused tutorials. Stay tuned for future releases that will make AvantLumi even more brilliant!

    Get Started Today!

    Ready to illuminate your projects? Visit the AvantLumi GitHub Repository for comprehensive guides, examples, and the latest release. Explore our growing collection of libraries and tutorials at AvantMaker’s GitHub or dive into our resources at AvantMaker.com.

    Happy Making! 🛠️✨

  • Unlock ESP32 Web Power: Dive Deep into HTTP POST Requests with Our New Article!

    Unlock ESP32 Web Power: Dive Deep into HTTP POST Requests with Our New Article!

    Hey Makers, Learners, and Innovators!

    Exciting news from the AvantMaker team! We know many of you are harnessing the power of the ESP32 to create amazing connected projects. A core part of many IoT applications is sending data from your ESP32 to a web server – whether it’s logging sensor readings, controlling a device remotely, or interacting with an online API. Often, this involves using the HTTP POST method via the ESP32’s HTTPClient library.

    But have you ever stopped to wonder what’s really happening under the hood when you call http.POST() in your Arduino sketch? What does that data packet actually look like as it travels across the internet?

    To help demystify this crucial process, we’ve just published a brand new, in-depth tutorial page:

    Understanding How Your ESP32 Sends the HTTP POST Request

    In this new guide, we go beyond just providing example code. We take a practical ESP32 sketch that sends data to the popular testing service httpbin.org and break down:

    1. The Arduino Sketch: A quick look at the code responsible for initiating the POST request.
    2. The Raw HTTP POST Request: We reconstruct the actual data packet sent by the ESP32, line by line. You’ll learn about the request line (POST method, path, HTTP version), essential headers like Host, Content-Type, and Content-Length, the crucial blank line separator, and the formatted data payload itself.
    3. The Server’s Response: We analyze the response from httpbin.org to confirm how the server received and interpreted the data sent by your ESP32.

    Why is this important?

    Understanding the structure of HTTP requests isn’t just academic. It empowers you to:

    • Troubleshoot effectively: When your ESP32 can’t connect or send data correctly, knowing what the request should look like is key to finding the problem.
    • Interact with APIs confidently: Many web services require data to be POSTed in a specific format. Understanding the components lets you craft the correct requests.
    • Design better projects: Knowing how data is packaged and sent helps you design more efficient and reliable communication for your IoT devices.

    This new page is part of our ongoing effort to build a comprehensive collection of references and tutorials within the AvantMaker ESP32 Resources Hub, helping you turn your innovative ideas into reality.

    Ready to deepen your understanding of how your ESP32 communicates with the web?

    Click here to read the full guide:

    Understanding How Your ESP32 Sends the HTTP POST Request

    We hope this resource proves valuable in your ESP32 development journey!

    Happy Making!


  • Expand Your ESP32 Knowledge: New Network Tutorials Added to Our Essential Guide!

    Expand Your ESP32 Knowledge: New Network Tutorials Added to Our Essential Guide!

    We’re excited to announce that we’ve just added new tutorial articles to our ESP32 Essential Guide! If you’re looking to master the networking capabilities of your ESP32, you’re in the right place.

    These new additions focus on the crucial network section of the ESP32, specifically diving deep into WiFi functionalities. Whether you’re a beginner looking to connect your ESP32 to a wireless network or an experienced maker wanting to explore advanced WiFi features, these tutorials provide clear, step-by-step instructions and practical examples.

    What can you expect to learn?

    • Setting up WiFi connections: Learn how to connect your ESP32 to various WiFi networks.
    • Understanding WiFi modes: Explore different WiFi modes and their applications.
    • Practical examples: Follow along with real-world scenarios and code snippets to solidify your understanding.

    We’ve designed these tutorials to be easy to follow, ensuring you can quickly grasp the concepts and apply them to your projects.

    Ready to dive in? Check out the new network section and WiFi chapter of our ESP32 Essential Guide here:

    ESP32 Essential Guide: Network Section – WiFi Chapter

    But that’s not all! We’re constantly working on expanding our ESP32 Essential Guide with more in-depth tutorials and practical examples. Stay tuned for future updates as we continue to add new content covering various aspects of the ESP32 ecosystem.

    We believe in empowering makers with the knowledge and tools they need to bring their ideas to life. Keep an eye on AvantMaker.com for more exciting tutorials and resources. Happy making!


  • Why We Call It the “WiFiClientSecure Library”

    Hey, makers, tinkerers! Welcome to AvantMaker.com, your go-to spot for all things DIY, AI, IoT, Smart Home, and STEM. Today, we’re pausing the soldering irons to tackle a tiny question you might’ve had: why do we call it the “WiFiClientSecure Library”? Spoiler: it’s not technically a library. Cue the suspenseful violin sting!

    The Geeky Lowdown

    Let’s nerd out for a sec. In the ESP32 Arduino core, there’s a library folder called NetworkClientSecure. Inside that lives a class—also named NetworkClientSecure—which gets a snazzy alias: WiFiClientSecure. So, yep, WiFiClientSecure is a class, not a library. Meanwhile, stuff like the WiFi library, HTTPClient library, and even good ol’ WiFiClient library? Those are all called libraries too, even though they’ve got classes inside them—like WiFiClassHTTPClient, and WiFiClient. Confused? Don’t be. When you’re coding your ESP32 to chat securely with the internet (hello, TLS/SSL superpowers!), you’re slapping #include <WiFiClientSecure.h> into your sketch and rolling with WiFiClientSecure client;. No one’s chanting “NetworkClientSecure” like it’s a secret code.

    Why “Library” Feels Right

    So why slap “library” on WiFiClientSecure? Because that’s how the maker world rolls! When you’re elbow-deep in a project, you’re not pondering, “Ah, the NetworkClientSecure class.” Nope, you’re searching “WiFiClientSecure tips” and calling it a day. Same deal with the WiFi library, HTTPClient library, and the rest—they’re all dubbed “libraries” in tutorials and coffee-fueled forum posts. It’s like calling your favorite snack “chips” instead of “crispy potato slices.” Technically, there’s a difference, but who cares when it tastes good?

    Are We Just Winging It?

    Not at all—we’re just keeping it chill. Here at AvantMaker.com, we’re all about making tech fun, not a yawn-inducing textbook chapter. If we hit you with “NetworkClientSecure Library” every time, you’d think we’re trying to sound like tech snobs (and nobody’s got time for that). The maker crowd calls it the “WiFiClientSecure Library”—from YouTube gurus to late-night Reddit rants—and we’re sticking with the people’s choice. Sure, the nitpickers out there might smirk and mutter, “Um, actually, it’s a class.” To them, we tip our hats: Well played, you eagle-eyed genius. But for the rest of us, “library” keeps it simple and snappy.

    Does It Even Matter?

    Whether you’re building a smart light or a plant-watering gizmo, the “WiFiClientSecure Library” is your buddy for locking down those connections. Call it a class, a library, or “that thing that keeps my data safe from sketchy Wi-Fi”—it’s the same trusty tool. So don’t sweat the label. We’re here to help you create awesome stuff, not to spark an existential crisis over naming conventions.

    Let’s Call It a Day

    At AvantMaker.com, we’re cheering for every maker—newbies, pros, and everyone who’s ever burned a finger on a hot glue gun. The “WiFiClientSecure Library” is just one piece of the puzzle to spark your next big thing. So grab your ESP32, code something epic, and don’t overthink the small stuff. We’ll keep shouting “library” from the rooftops—and maybe mumble “NetworkClientSecure” under our breath when the nerd police aren’t listening. Deal?

    Now, quit reading and start building—your masterpiece won’t invent itself!

error: Content is protected !!