ICT 361: Introduction to Robotics
Mr. Seng Theara
By the end of the lesson, student will be able to:
Understand how a joystick works electrically
Explain pull-up button logic
Read analog and digital signals
Map controller inputs to robot movements
Design basic control logic for robots
By the end of the lesson, student will be able to:
Explain what Dabble is and why it is used
Understand Bluetooth communication between a smartphone and ESP32
Configure ESP32 to communicate with Dabble
Read joystick and button inputs from the Dabble app
Control hardware (LED, motor, robot) using a smartphone
Debug common Bluetooth and app-connection issues
4 Buttons
Joystick
Dabble is a smartphone app that allows you to control microcontrollers without building a custom mobile app.
Dabble provides ready-made modules:
🎮 Gamepad (joystick, buttons)
🔘 Digital buttons
📈 Sensor dashboard
🔊 Voice control
🧭 Accelerometer & gyroscope
💬 Terminal
Smartphone
ESP32
Hardware
Steps
Install Dabble on phone
Enable Bluetooth
Open Dabble
Select Gamepad Module
Connect to ESP32 Bluetooth name
UP
LEFT
DOWN
RIGHT
SQUARE
TRIANGLE
CIRCLE
CROSS
UP
LEFT
DOWN
RIGHT
SQUARE
TRIANGLE
CIRCLE
CROSS
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <DabbleESP32.h>
const char* BT_NAME = "Name";
void setup() {
Serial.begin(115200);
Dabble.begin(BT_NAME);
Serial.println("Dabble Gamepad connected");
}
void loop() {
Dabble.processInput();
// Direction buttons
if (GamePad.isUpPressed()) {
Serial.println("UP pressed");
}
if (GamePad.isDownPressed()) {
Serial.println("DOWN pressed");
}
if (GamePad.isLeftPressed()) {
Serial.println("LEFT pressed");
}
if (GamePad.isRightPressed()) {
Serial.println("RIGHT pressed");
}
// Action buttons
if (GamePad.isSquarePressed()) {
Serial.println("SQUARE pressed");
}
if (GamePad.isTrianglePressed()) {
Serial.println("TRIANGLE pressed");
}
if (GamePad.isCirclePressed()) {
Serial.println("CIRCLE pressed");
}
if (GamePad.isCrossPressed()) {
Serial.println("CROSS pressed");
}
// Control buttons
if (GamePad.isStartPressed()) {
Serial.println("START pressed");
}
if (GamePad.isSelectPressed()) {
Serial.println("SELECT pressed");
}
delay(50);
}
Gamepad provides:
Joystick Mode
7
Y
-7
7
-7
X
7
Y
-7
7
-7
X
#define CUSTOM_SETTINGS
#define INCLUDE_GAMEPAD_MODULE
#include <DabbleESP32.h>
const char* BT_NAME = "Name";
int joyX = 0;
int joyY = 0;
void setup() {
Serial.begin(115200);
Dabble.begin(BT_NAME);
Serial.println("Dabble Gamepad - Joystick Mode");
}
void loop() {
Dabble.processInput();
// Read joystick values
joyX = GamePad.getXaxisData(); // -7 to +7
joyY = GamePad.getYaxisData(); // -7 to +7
Serial.print("Joystick X: ");
Serial.print(joyX);
Serial.print(" | Joystick Y: ");
Serial.println(joyY);
delay(100);
}
Gamepad provides:
Accelerometer Mode