@@Amy-kh3zl Thank you for the feedback!! Yes, that's a great suggestion! :) I just started, subs shares and like would really help me a lot to grow and keep making video like this! :)
Hi!! Thank you for your interest, I am planning to create a GitHub repository soon, to release codes. Stay tuned! Consider that any sub like and share woul really help me a lot at this stage!
Meanwhile I am pasting it here below. Consider that a like a share and a sub would greatly help me at this stage. Let me know if it works. ____________________________ #include "BleMouse.h" // Include the Bluetooth Mouse library // Create a BluetoothMouse object BleMouse bleMouse; // Define the pins for the joystick and the switch const int vxPin = 32; // Joystick x-axis (horizontal) -> GPIO 32 (analog) const int vyPin = 33; // Joystick y-axis (vertical) -> GPIO 33 (analog) const int swPin = 25; // Joystick button switch -> GPIO 25 (digital) // Sensitivity for cursor movement int sensitivity = 20; // Adjust this value to control cursor speed // Define the new center values and dead zone for joystick movement int centerValue = 3000; // Central value based on your joystick's calibration int deadZone = 200; // Wider dead zone to prevent small movements void setup() { // Initialize serial communication for debugging Serial.begin(9600); // Begin Bluetooth Mouse bleMouse.begin(); Serial.println("Bluetooth Mouse is ready to pair"); // Configure analog pins with pull-down resistors if needed pinMode(vxPin, INPUT_PULLDOWN); pinMode(vyPin, INPUT_PULLDOWN); // Configure the joystick button pin pinMode(swPin, INPUT_PULLUP); // Joystick button uses pull-up resistor } void loop() { if (bleMouse.isConnected()) { // Read joystick values int vxValue = analogRead(vxPin); int vyValue = analogRead(vyPin); int swValue = digitalRead(swPin); // Read joystick button state // Print joystick values for debugging Serial.print("VX: "); Serial.print(vxValue); Serial.print(" | VY: "); Serial.println(vyValue); // Center the readings around the new center value (3000) int xDeviation = vxValue - centerValue; int yDeviation = vyValue - centerValue; int deltaX = 0; int deltaY = 0; // Map the deviations to cursor movement if outside the widened dead zone if (abs(xDeviation) > deadZone) { deltaX = map(xDeviation, -2048, 2047, -sensitivity, sensitivity); } if (abs(yDeviation) > deadZone) { deltaY = map(yDeviation, -2048, 2047, -sensitivity, sensitivity); } // Move the cursor based on joystick input bleMouse.move(deltaX, -deltaY); // Invert deltaY for natural movement // Handle joystick button press for mouse click if (swValue == LOW) { // Button is pressed (active low) if (!bleMouse.isPressed(MOUSE_LEFT)) { bleMouse.press(MOUSE_LEFT); // Press left mouse button } } else { if (bleMouse.isPressed(MOUSE_LEFT)) { bleMouse.release(MOUSE_LEFT); // Release left mouse button } } delay(20); // Smoother movement } else { Serial.println("Mouse not connected"); delay(1000); // Check every second if the Bluetooth mouse is connected } }
Thank you for your interest. I am going to paste the code in the description. Consider that a like, a sub, and a share would greatly help me at this stage!
@@lochobhai I am actually pasting it here: _____________________ #include "BleMouse.h" // Include the Bluetooth Mouse library // Create a BluetoothMouse object BleMouse bleMouse; // Define the pins for the joystick and the switch const int vxPin = 32; // Joystick x-axis (horizontal) -> GPIO 32 (analog) const int vyPin = 33; // Joystick y-axis (vertical) -> GPIO 33 (analog) const int swPin = 25; // Joystick button switch -> GPIO 25 (digital) // Sensitivity for cursor movement int sensitivity = 20; // Adjust this value to control cursor speed // Define the new center values and dead zone for joystick movement int centerValue = 3000; // Central value based on your joystick's calibration int deadZone = 200; // Wider dead zone to prevent small movements void setup() { // Initialize serial communication for debugging Serial.begin(9600); // Begin Bluetooth Mouse bleMouse.begin(); Serial.println("Bluetooth Mouse is ready to pair"); // Configure analog pins with pull-down resistors if needed pinMode(vxPin, INPUT_PULLDOWN); pinMode(vyPin, INPUT_PULLDOWN); // Configure the joystick button pin pinMode(swPin, INPUT_PULLUP); // Joystick button uses pull-up resistor } void loop() { if (bleMouse.isConnected()) { // Read joystick values int vxValue = analogRead(vxPin); int vyValue = analogRead(vyPin); int swValue = digitalRead(swPin); // Read joystick button state // Print joystick values for debugging Serial.print("VX: "); Serial.print(vxValue); Serial.print(" | VY: "); Serial.println(vyValue); // Center the readings around the new center value (3000) int xDeviation = vxValue - centerValue; int yDeviation = vyValue - centerValue; int deltaX = 0; int deltaY = 0; // Map the deviations to cursor movement if outside the widened dead zone if (abs(xDeviation) > deadZone) { deltaX = map(xDeviation, -2048, 2047, -sensitivity, sensitivity); } if (abs(yDeviation) > deadZone) { deltaY = map(yDeviation, -2048, 2047, -sensitivity, sensitivity); } // Move the cursor based on joystick input bleMouse.move(deltaX, -deltaY); // Invert deltaY for natural movement // Handle joystick button press for mouse click if (swValue == LOW) { // Button is pressed (active low) if (!bleMouse.isPressed(MOUSE_LEFT)) { bleMouse.press(MOUSE_LEFT); // Press left mouse button } } else { if (bleMouse.isPressed(MOUSE_LEFT)) { bleMouse.release(MOUSE_LEFT); // Release left mouse button } } delay(20); // Smoother movement } else { Serial.println("Mouse not connected"); delay(1000); // Check every second if the Bluetooth mouse is connected } }
Hello! Thank you so much for your interest! I'm planning to create a GitHub repository soon to share my codes, so stay tuned for updates. Your support through subscribing, liking, and sharing would mean the world to me and help me grow at this stage!
@@ThinkingThings-q4p My support through subscribing, liking, and sharing only makes sense if your channel is useful to me. If the author doesn't bother to publish the code, I won't support, like, or subscribe. It makes no sense. No code = no like or channel subscription.
@@karelbenda5322 Thank you for your feedback! I understand how helpful having access to the code can be, and I truly appreciate your perspective. My channel focuses on sharing ideas, demonstrations, and inspiration for DIY projects. As I mentioned, I plan to create a GitHub repository soon to share my projects more broadly. Of course, the choice to subscribe is entirely yours, and I respect that. Thanks again for your input, and I hope to see you around!
Nice ♥♥♥
Thank you! Cheers!
amazing video buddy! make more amazing projects like this
Thanks so much, I really appreciate it! A like, sub, and share would help me a lot at this stage!
Nice video!!!
can you make a simple/mid project using esp32,how to use potentiometer with it,and further explain how to use joystick and the pins?👌👍
@@Amy-kh3zl Thank you for the feedback!! Yes, that's a great suggestion! :) I just started, subs shares and like would really help me a lot to grow and keep making video like this! :)
I made the Joystick tutorial! :)
same code for windows? also still waiting on your code, i have some cool ideas to add
Yes, i am using the Arduino IDE that you can use also on Windows. I am planning to make a GitHub to release the code, stay tuned!
CODE???????????????????
Hi!! Thank you for your interest, I am planning to create a GitHub repository soon, to release codes. Stay tuned!
Consider that any sub like and share woul really help me a lot at this stage!
Meanwhile I am pasting it here below.
Consider that a like a share and a sub would greatly help me at this stage.
Let me know if it works.
____________________________
#include "BleMouse.h" // Include the Bluetooth Mouse library
// Create a BluetoothMouse object
BleMouse bleMouse;
// Define the pins for the joystick and the switch
const int vxPin = 32; // Joystick x-axis (horizontal) -> GPIO 32 (analog)
const int vyPin = 33; // Joystick y-axis (vertical) -> GPIO 33 (analog)
const int swPin = 25; // Joystick button switch -> GPIO 25 (digital)
// Sensitivity for cursor movement
int sensitivity = 20; // Adjust this value to control cursor speed
// Define the new center values and dead zone for joystick movement
int centerValue = 3000; // Central value based on your joystick's calibration
int deadZone = 200; // Wider dead zone to prevent small movements
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Begin Bluetooth Mouse
bleMouse.begin();
Serial.println("Bluetooth Mouse is ready to pair");
// Configure analog pins with pull-down resistors if needed
pinMode(vxPin, INPUT_PULLDOWN);
pinMode(vyPin, INPUT_PULLDOWN);
// Configure the joystick button pin
pinMode(swPin, INPUT_PULLUP); // Joystick button uses pull-up resistor
}
void loop() {
if (bleMouse.isConnected()) {
// Read joystick values
int vxValue = analogRead(vxPin);
int vyValue = analogRead(vyPin);
int swValue = digitalRead(swPin); // Read joystick button state
// Print joystick values for debugging
Serial.print("VX: ");
Serial.print(vxValue);
Serial.print(" | VY: ");
Serial.println(vyValue);
// Center the readings around the new center value (3000)
int xDeviation = vxValue - centerValue;
int yDeviation = vyValue - centerValue;
int deltaX = 0;
int deltaY = 0;
// Map the deviations to cursor movement if outside the widened dead zone
if (abs(xDeviation) > deadZone) {
deltaX = map(xDeviation, -2048, 2047, -sensitivity, sensitivity);
}
if (abs(yDeviation) > deadZone) {
deltaY = map(yDeviation, -2048, 2047, -sensitivity, sensitivity);
}
// Move the cursor based on joystick input
bleMouse.move(deltaX, -deltaY); // Invert deltaY for natural movement
// Handle joystick button press for mouse click
if (swValue == LOW) { // Button is pressed (active low)
if (!bleMouse.isPressed(MOUSE_LEFT)) {
bleMouse.press(MOUSE_LEFT); // Press left mouse button
}
} else {
if (bleMouse.isPressed(MOUSE_LEFT)) {
bleMouse.release(MOUSE_LEFT); // Release left mouse button
}
}
delay(20); // Smoother movement
} else {
Serial.println("Mouse not connected");
delay(1000); // Check every second if the Bluetooth mouse is connected
}
}
povide your code
Thank you for your interest. I am going to paste the code in the description.
Consider that a like, a sub, and a share would greatly help me at this stage!
Thanks ❤❤❤
@@lochobhai I am actually pasting it here:
_____________________
#include "BleMouse.h" // Include the Bluetooth Mouse library
// Create a BluetoothMouse object
BleMouse bleMouse;
// Define the pins for the joystick and the switch
const int vxPin = 32; // Joystick x-axis (horizontal) -> GPIO 32 (analog)
const int vyPin = 33; // Joystick y-axis (vertical) -> GPIO 33 (analog)
const int swPin = 25; // Joystick button switch -> GPIO 25 (digital)
// Sensitivity for cursor movement
int sensitivity = 20; // Adjust this value to control cursor speed
// Define the new center values and dead zone for joystick movement
int centerValue = 3000; // Central value based on your joystick's calibration
int deadZone = 200; // Wider dead zone to prevent small movements
void setup() {
// Initialize serial communication for debugging
Serial.begin(9600);
// Begin Bluetooth Mouse
bleMouse.begin();
Serial.println("Bluetooth Mouse is ready to pair");
// Configure analog pins with pull-down resistors if needed
pinMode(vxPin, INPUT_PULLDOWN);
pinMode(vyPin, INPUT_PULLDOWN);
// Configure the joystick button pin
pinMode(swPin, INPUT_PULLUP); // Joystick button uses pull-up resistor
}
void loop() {
if (bleMouse.isConnected()) {
// Read joystick values
int vxValue = analogRead(vxPin);
int vyValue = analogRead(vyPin);
int swValue = digitalRead(swPin); // Read joystick button state
// Print joystick values for debugging
Serial.print("VX: ");
Serial.print(vxValue);
Serial.print(" | VY: ");
Serial.println(vyValue);
// Center the readings around the new center value (3000)
int xDeviation = vxValue - centerValue;
int yDeviation = vyValue - centerValue;
int deltaX = 0;
int deltaY = 0;
// Map the deviations to cursor movement if outside the widened dead zone
if (abs(xDeviation) > deadZone) {
deltaX = map(xDeviation, -2048, 2047, -sensitivity, sensitivity);
}
if (abs(yDeviation) > deadZone) {
deltaY = map(yDeviation, -2048, 2047, -sensitivity, sensitivity);
}
// Move the cursor based on joystick input
bleMouse.move(deltaX, -deltaY); // Invert deltaY for natural movement
// Handle joystick button press for mouse click
if (swValue == LOW) { // Button is pressed (active low)
if (!bleMouse.isPressed(MOUSE_LEFT)) {
bleMouse.press(MOUSE_LEFT); // Press left mouse button
}
} else {
if (bleMouse.isPressed(MOUSE_LEFT)) {
bleMouse.release(MOUSE_LEFT); // Release left mouse button
}
}
delay(20); // Smoother movement
} else {
Serial.println("Mouse not connected");
delay(1000); // Check every second if the Bluetooth mouse is connected
}
}
@@ThinkingThings-q4p code does not work
@@im_anhar What kind of error do you get?
Interesting video, but the code is missing. Please fill it in.
Hello! Thank you so much for your interest! I'm planning to create a GitHub repository soon to share my codes, so stay tuned for updates.
Your support through subscribing, liking, and sharing would mean the world to me and help me grow at this stage!
@@ThinkingThings-q4p My support through subscribing, liking, and sharing only makes sense if your channel is useful to me. If the author doesn't bother to publish the code, I won't support, like, or subscribe. It makes no sense. No code = no like or channel subscription.
@@karelbenda5322 Thank you for your feedback! I understand how helpful having access to the code can be, and I truly appreciate your perspective. My channel focuses on sharing ideas, demonstrations, and inspiration for DIY projects. As I mentioned, I plan to create a GitHub repository soon to share my projects more broadly.
Of course, the choice to subscribe is entirely yours, and I respect that. Thanks again for your input, and I hope to see you around!