#include <Mouse.h> crashes my serial monitor

Hi everyone,

I’m trying to create a wireless click, with two arduinos, so when I press a button on one (UNO), it sends an RF signal to another (Leonardo), which then clicks the computer. I have the transmitter and receiver working well, and they post to the serial monitor well. However, whenever I include the Mouse library or attempt to use any mouse capabilities, the serial monitor stops working and it doesn’t work. Any suggestions as to what I can to to stop it? Thanks.

Transmitter code

// Include RadioHead Amplitude Shift Keying Library
#include <RH_ASK.h>
// Include dependant SPI Library 
#include <SPI.h> 
 
// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
const int button = 9;
int switchstate = 0;
String output = "0";

void setup()
{
    // Initialize ASK Object
    rf_driver.init();
    pinMode(button, INPUT);
}
 
void loop()
{
    switchstate = digitalRead(button);

    if(switchstate == HIGH){
   const char *msg = "1";
    rf_driver.send((uint8_t *)msg, strlen(msg));
    rf_driver.waitPacketSent();
    delay(10);
    }
    else if(switchstate == LOW){
  const char *msg = "0";
    rf_driver.send((uint8_t *)msg, strlen(msg));
    rf_driver.waitPacketSent();
    delay(10);
    }
}

Receiver Code

#include <RH_ASK.h>
// Include dependant SPI Library 
#include <Mouse.h>
#include <SPI.h> 

// Create Amplitude Shift Keying Object
RH_ASK rf_driver;
int str_out;
 
void setup()
{
  Mouse.begin();
    // Initialize ASK Object
    rf_driver.init();
    // Setup Serial Monitor
    Serial.begin(9600);
}
 
void loop()
{
    // Set buffer to size of expected message
    uint8_t buf[1];
    uint8_t buflen = sizeof(buf);
    // Check if received packet is correct size
    if (rf_driver.recv(buf, &buflen))
    {
      str_out = int((char*)buf);
      if(str_out == 1){
        Mouse.press();
      }
        Serial.println((char*)buf);
    
             
    }
}