FastLED 3.9.15
|
Educational tutorial for FastLED WASM networking with explicit types.
This tutorial demonstrates network functionality in FastLED WASM builds, specifically the fetch API for making HTTP requests. It shows two different approaches for handling asynchronous operations with EXPLICIT TYPES for educational clarity.
EDUCATIONAL FOCUS: All types are explicitly declared instead of using 'auto' to help you understand the FastLED type system and async patterns.
TWO ASYNC APPROACHES DEMONSTRATED:
APPROACH 1: Promise-based with .then() and .catch_() callbacks (JavaScript-like)
APPROACH 2: fl::await_top_level() pattern for synchronous-style async code
The example toggles between these approaches every 10 seconds to demonstrate both patterns working with the same underlying fetch API.
FASTLED ASYNC TYPE SYSTEM TUTORIAL:
Key Types You'll Learn:
NEW FETCH API STRUCTURE:
EXPLICIT TYPE EXAMPLES:
Promise-based approach:
Await-based approach:
TO RUN THIS TUTORIAL:
For WASM (recommended for networking):
pip install fastled
fastled NetTest.ino
For other platforms: Uses mock responses for testing the API without network connectivity
Definition in file NetTest.ino.