Enable button with sensor

Hello guys, my friend tried to make a code for press mouse.right button when the sensor see something on front
I got pro micro 3.3v and tcrt5000 ir sensor

cost int sensorPin = 4
void setup()     {
Serial.begin(9600);

}
void loop()     {
if (digitalRead(sensorPin)== HIGH) {
Serial.println ("Press left button");
}
else{
Serial.printin ("dont press nothing");
}
delay(50);

But It only send mensage on serial monitor when i put something on front and dosnt press nothing…

I tried this for myself but nothing…

#include <Mouse.h>


const int sensorPin = 14;
int mouse_left;

void setup() {
Serial.begin(9600);
Mouse.begin();
}

void loop() {


if (digitalRead(sensorPin)== HIGH) {
Mouse.press();
}
else{
if (digitalRead(sensorPin)== LOW)
Mouse.release();


delay(50);

Whats wrong here? :frowning:

The first code would not even compile...

I fixed thanks!!