Arduino Nano ESP32 - DIYables Bluetooth App Slider
Overview
This example provides dual slider controls on the Arduino Nano ESP32 using BLE (Bluetooth Low Energy) via the DIYables Bluetooth STEM app. Control two independent values with configurable range and step from a smartphone. Suitable for LED brightness, motor speed, servo positioning, and any application requiring adjustable numeric input.
Note: The Arduino Nano ESP32 supports BLE only — Classic Bluetooth is not supported. The DIYables Bluetooth App works on both Android and iOS with BLE.

Features
- Dual Sliders: Two independent slider controls
- Configurable Range: Set minimum, maximum, and step values
- Real-Time Updates: Slider values transmitted instantly on change
- PWM Ready: Map slider values directly to PWM output
- Android & iOS Support: BLE is compatible with both platforms
- No Pairing Required: BLE connects without manual pairing
- Low Power: BLE consumes less power than Classic Bluetooth
Hardware Preparation
Or you can buy the following kits:
| 1 | × | DIYables Sensor Kit (30 sensors/displays) | |
| 1 | × | DIYables Sensor Kit (18 sensors/displays) |
Additionally, some of these links are for products from our own brand, DIYables .
Arduino Nano ESP32 Code
Detailed Instructions
- New to the Arduino Nano ESP32? Start with the Arduino Nano ESP32 getting started guide.
- Connect the Arduino Nano ESP32 to your computer via USB.
- Open Arduino IDE.
- Select the Arduino Nano ESP32 board and the correct COM port.
- Click the Libraries icon in the left sidebar.
- Search for "DIYables Bluetooth" and select the DIYables Bluetooth library by DIYables.
- Click Install.

- When prompted to install dependencies, click Install All.

BLE Code
- In Arduino IDE, open File Examples DIYables Bluetooth ArduinoBLE_Slider, or paste the code into the editor.
- Click Upload to flash the sketch to the board.
- Open the Serial Monitor.
- The Serial Monitor output should look like:
Mobile App
Note: The DIYables Bluetooth App works on both Android and iOS with BLE. No manual pairing is required.
- Launch the DIYables Bluetooth App.
- On first launch, grant the following permissions:
- Nearby Devices (Android 12+) / Bluetooth (iOS) — required to scan and connect to Bluetooth devices
- Location (Android 11 and below only) — required by older Android versions to scan for BLE
- Ensure Bluetooth is enabled on your device.
- Tap Connect on the home screen. The app will scan for BLE devices.

- Tap "Arduino_Slider" in the scan results.
- After connecting, return to the home screen and open the Slider app.

Tap the settings icon on the home screen to show or hide apps. See the DIYables Bluetooth App User Manual for details.
- Drag the sliders to change values.

Now look back at the Serial Monitor on Arduino IDE. You will see:
- Adjust the sliders and observe the values update in real time in the Serial Monitor.
Creative Customization - Adapt the Code to Your Project
Configure Slider Range
Handle Slider Changes
Send Current Values to App
Handle Connection Events
Programming Examples
LED Brightness Control
Servo Control
Motor Speed with Direction
Advanced Programming Techniques
Slider with Dead Zone
Rate Limiting
Troubleshooting
Common Issues
1. Device not visible in the app
- Confirm the board is powered on and the sketch is uploaded
- Verify Bluetooth is enabled on your phone
- On Android 11 and below, enable Location services as well
- Try restarting Bluetooth on your phone
2. Slider changes not received
- Check the Bluetooth connection status in the app
- Confirm the onSliderValue callback is registered correctly
- Review the Serial Monitor for error messages
3. PWM output not working
- Confirm the pin supports PWM
- Check wiring connections
- Test with a simple analogWrite sketch first
4. Slider resets to 0 on reconnect
- Implement the onGetConfig callback to send stored values on reconnect
- Persist slider values in variables across connections
5. Connection drops frequently
- Reduce distance to the Arduino
- Check for interference from other BLE devices
- Ensure a stable USB power supply
6. Upload fails or board not recognized
- Install the latest Arduino Nano ESP32 board package via Board Manager
- Try a different USB cable or port
- Press the reset button before uploading
Project Ideas
Lighting Control
- Dual LED brightness controller
- RGB LED color mixer (use two sliders for hue/saturation)
- LED strip brightness and color temperature
- Stage lighting dimmer
Motor Control
- DC motor speed controller
- Dual servo positioning
- Pan-tilt camera mount
- Robot wheel speed
Audio
- Volume control
- Tone frequency and duration
- Equalizer bands
Next Steps
After completing the Bluetooth Slider example, explore:
- Bluetooth Joystick — 2D directional control
- Bluetooth Rotator — Angular/rotational control
- Bluetooth Temperature — Temperature gauge display
- Multiple Bluetooth Apps — Combine slider with other app widgets
Support
For additional help:
- Check the API Reference documentation
- Visit DIYables tutorials
- Arduino community forums