Connection digital output from Seeed Studio XIAO Expansion board

Hi Folks,

I would like to plug an haptic motor (3.7V - 38mA) to the XIAO Expansion board through the A0-D0 grove.

This is the schematic of the A0-D0 grove of the expansion board:
image


Just for information, this is the link to the full schematic:


Does that mean I just need to remove the 2nd and 3rd wire of my grove connector?
That would look like this:
image

and connect the 2 wires to the haptic motor ?

I did not see many applications that need only 1 positive wire and ground.
Most of the applications I saw use a remote control and a grove IC.
So I just wanted to see if it was right.

Would appreciate any input.

Thank you.

Cheers!

I just realized that it would make the haptic motor going on all the time.
So instead I should use the A0 pin to open an close a transistor and simulate PWM like this (if I want to have a potentiometer effect):

int pwmPin = A0; // Set the PWM pin to A0
int dutyCycle = 128; // Set the duty cycle to 50% (out of 255)

void setup() {
// Initialize the PWM pin
pinMode(pwmPin, OUTPUT);
}

void loop() {
// Write the PWM signal to the pin
analogWrite(pwmPin, dutyCycle);
}