Example Code for Arduino-WheelPad
Last revision 2025/12/12
This article offers detailed instructions on setting up and programming the Arduino-WheelPad using a 3.3V Arduino Pro Mini and the MPR121 library, featuring hardware and software preparation, wiring diagrams, and sample code to help users explore touch sensor technology.
Hardware Preparation
- 3.3V Arduino Pro Mini: Quantity 1
- DFRobot Touch Kit (WheelPad): Quantity 1
- Wiring: SDA -> A4, SCL -> A5, IRQ -> D2
Software Preparation
- Development Tool: Arduino IDE
- Library: MPR121 v1.0.zip
Wiring Diagram
Wheel pad CD
The pin number is the same to the PCB board one.
Other Preparation Work
Please download the MPR121 v1.0.zip first.
Sample Code
/*
TouchWheel.pde
MPR121 WhellPad Example Code
by:Waiman Zhao
Mail:[email protected]
created on: 11/2/14
license: CC-SA 3.0
Hardware: 3.3V Arduino Pro Mini
SDA -> A4
SCL -> A5
IRQ -> D2
*/
#include <Wire.h>
#include <mpr121.h>
int key = 0;
// ========= setup =========
void setup()
{
// initialize function
Serial.begin(19200);
Wire.begin();
CapaTouch.begin();
delay(500);
Serial.println("START");
}
// ========= loop =========
void loop()
{
key=CapaTouch.keyPad();
if (key==1)
{ Serial.print("wheel:");
Serial.println("0");
}
if (key==4)
{ Serial.print("wheel:");
Serial.println("1");
}
if (key==7)
{ Serial.print("wheel:");
Serial.println("2");
}
if (key==11)
{ Serial.print("wheel:");
Serial.println("3");
}
if (key==2)
{ Serial.print("wheel:");
Serial.println("4");
}
if (key==5)
{ Serial.print("wheel:");
Serial.println("5");
}
if (key==8)
{ Serial.print("wheel:");
Serial.println("6");
}
if (key==0)
{ Serial.print("wheel:");
Serial.println("7");
}
if (key==3)
{ Serial.print("wheel:");
Serial.println("8");
}
delay(200);
}
Was this article helpful?
