XIAO NRF52840 Touch Sensor and DC Motor with Arduino Code

I want to activate a dc motor with a touch sensor. Specifically have the motor on when the touch sensor is not activated and the dc motor off when the touch sensor is activated. I attached my current wiring and code (which didn’t work) below. The touch sensor turns on but motor doesn’t move. I tested the motor and it works fine, just not with this code or board. Any help is appreciated.

#define TOUCH 10 //the touch sensor is connected to D10

int DCMOTOR = 9; // pin for the DC motor.

void setup()

{

pinMode(DCMOTOR, OUTPUT);

pinMode(TOUCH, INPUT);

}

void loop()

{

int sensorValue = digitalRead(TOUCH);

if(sensorValue)

{

digitalWrite(DCMOTOR, HIGH); // Start DC motor

while(digitalRead(TOUCH) == HIGH);

digitalWrite(DCMOTOR, LOW); // Stop DC Motor

}

}