Hw-044 Datasheet Page
The board includes a red "Touch" LED. While useful for debugging, note that the LED is tied to the output pin via a transistor. This means:
Here is a simple sketch to test your HW-044.
Wiring:
The Code (with debounce logic):
const int TOUCH_PIN = 2; const int LED_PIN = 13;int lastTouchState = LOW; int currentTouchState; hw-044 datasheet
void setup() pinMode(TOUCH_PIN, INPUT); pinMode(LED_PIN, OUTPUT); Serial.begin(9600); Serial.println("HW-044 Touch Sensor Ready");
void loop() currentTouchState = digitalRead(TOUCH_PIN); The board includes a red "Touch" LED
if (currentTouchState == HIGH && lastTouchState == LOW) // Touch detected (edge detection) Serial.println("Touched!"); digitalWrite(LED_PIN, !digitalRead(LED_PIN)); // Toggle onboard LED delay(50); // Simple debounce
lastTouchState = currentTouchState;
Before we look at the board, let's look at the datasheet for the core IC. The Code (with debounce logic): const int TOUCH_PIN