Blynk Joystick [work] ❲OFFICIAL - 2024❳
Click on the widget to open its settings. Assign it to a Virtual Pin, such as V1 .
For the best performance, always place Blynk.run() in the void loop() and avoid using delay() in your Arduino code.
: You can define the minimum and maximum values for both axes to fit your motor speed or servo range. Setting Up the Blynk Joystick (Blynk 2.0) blynk joystick
The Blynk Joystick widget functions just like a physical analog joystick. It translates thumb movements on your smartphone screen into two distinct data streams representing the X and Y axes. Key Features
To get started, you must set up the widget properly inside the Blynk IoT app (iOS or Android). 1. Add the Widget Click on the widget to open its settings
#define BLYNK_TEMPLATE_ID "YOUR_TEMPLATE_ID" #define BLYNK_TEMPLATE_NAME "YOUR_TEMPLATE_NAME" #define BLYNK_AUTH_TOKEN "YOUR_AUTH_TOKEN" #define BLYNK_PRINT Serial #include #include #include // WiFi Credentials char auth[] = BLYNK_AUTH_TOKEN; char ssid[] = "YOUR_WIFI_SSID"; char pass[] = "YOUR_WIFI_PASSWORD"; // Global variables to store coordinate values int joystickX = 0; int joystickY = 0; // This function executes every time the Joystick widget updates on Virtual Pin 1 BLYNK_WRITE(V1) Joystick Y: "); Serial.println(joystickY); // Execute motor mixing logic processMotorControls(joystickX, joystickY); void processMotorControls(int x, int y) // Basic differential drive calculation int leftMotorSpeed = y + x; int rightMotorSpeed = y - x; // Constrain outputs to match your project boundaries (e.g., -255 to 255 for PWM) leftMotorSpeed = constrain(leftMotorSpeed, -255, 255); rightMotorSpeed = constrain(rightMotorSpeed, -255, 255); // Placeholder for actual motor driving hardware commands // positive values = Forward direction, negative values = Reverse direction if (leftMotorSpeed >= 0) // Code to drive Left Motor FORWARD at abs(leftMotorSpeed) else // Code to drive Left Motor REVERSE at abs(leftMotorSpeed) if (rightMotorSpeed >= 0) // Code to drive Right Motor FORWARD at abs(rightMotorSpeed) else // Code to drive Right Motor REVERSE at abs(rightMotorSpeed) void setup() Serial.begin(115200); // Initialize Blynk connection Blynk.begin(auth, ssid, pass); void loop() Blynk.run(); Use code with caution. Optimizing Performance and Troubleshooting
: Automatically resets values to zero (or mid-point) when released. : You can define the minimum and maximum
ESP32 → 2x Servo motors - V0 (X) → Pan servo (horizontal angle) - V1 (Y) → Tilt servo (vertical angle)
: Allows you to send data as a single array or split into two separate virtual pins. Configuring the Blynk Joystick in the App
It binds to a single Virtual Pin (e.g., V1 ) but transmits two distinct values inside an array.
This tiered structure allows projects to scale seamlessly from a simple weekend prototype to a commercial deployment with thousands of devices, without ever needing to switch platforms.