EasyManua.ls Logo

DFRobot FireBeetle ESP32-E - Page 31

DFRobot FireBeetle ESP32-E
92 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Member Function
hallRead()
Description: read the value of built-in hall sensor Return: return integer 0-255; Positive number for North pole; Negative number for South
pole. The stronger the magnetic field, the greater the absolute value
7.5 Compacitive Keys
ESP32 provides the function of capacitive touch sensor. There are 9 touch sensors (T0, T2 ~ T9)available, corresponding to pins 4, 2, 15, 13, 12,
14, 27, 33 and 32 respectively. There is no need to set PinMode. The return value of touchRead() is within 0 ~ 255. The greater the touch force,
the smaller the return value. Burning this sample code into your board, use the pin 4/D12 as the touch key, the touch value will be returned
through the serial port monitor.
void setup()
{
Serial.begin(9600);
}
void loop()
{
Serial.printf("touch:%d\n",touchRead(4));
}
Result