communication between 2 arduino's (thrpugh PWM)

so for a school project i was in need for an LCD touchscreen and about 6 servo motors
The LCD touchscreen is placed with a shield on my arduino mega and the pins that i have left over are; Digital pin 8-13 and all analog/communication pin's

the 6 servo motors will be connected to my adruino uno.
How can i communicate between my uno and mega to send signals if the servo's need to "open" or "close" i was thinking to send a PWM from my mega to the uno and with certain value's certain acctions will happen, but it didnt work as expected. So maybe if you guys have some idea's or can help me with this ?

ty

You didn't show your code. The problem is definitely in the code you didn't show.

Post an example with the simplest possible "sender" code. Something like the AnalogInput example. We don't need to see the LCD interface yet.

Then show what the UNO code is and try to explain a bit more about what it actually does and what you want it to do differently.

PlatoBE:
How can i communicate between my uno and mega to send signals if the servo's need to "open" or "close" i was thinking to send a PWM from my mega to the uno and with certain value's certain acctions will happen, but it didnt work as expected. So maybe if you guys have some idea's or can help me with this ?

It is not obvious why you would choose PWM to communicate between the two.
You could use digital signals to communicate simple on/off information or you could use the Tx and Rx pins to send complex messages between the two.

 #include <Servo.h>

Servo myservo1;
Servo myservo2;
   
int valanalogI1;   //analog Input 0
int valanalogI2;   // analog Input 1

void setup() {
  myservo1.attach(9); 
  myservo2.attach(10);
  Serial.begin(9600);
}

void loop() {
  valanalogI1 = analogRead(1);  
  valanalogI2 = analogRead(2);  
         
  Serial.println(valanalogI1);
  Serial.println(valanalogI2);
  
if(valanalogI1>500){
 myservo1.write(180);
}
else{
 myservo1.write(0);
}

if(valanalogI2>500){
  myservo2.write(180);
}
else{
  myservo2.write(0);
}
delay(1000);
}

this is the code for the UNO, just reading 2 analog pins, if the input is more or less then +/- 2,5V the servo' will take a certain possition.

the code for the adruino mega if just analogWrite(pin,val) not more then that, i'm using pin 8 and 9 which are PWM pins on the mega. if i put both the mega pins on 0, my analog input on my uno still gives me random value's between 0-1023

maybe theres something wrong with my approach? with the code it self? maybe it is because of the PWM frequency ?

maybe i could use the communication (RX/TX) pins, if so then how do i have to code this ?

Did you connect the grounds?

Do you have any other analog filtering components between the UNO and the MEGA?

The thing is, PWM is just a sequence of on/off pulses. If you just connect this straight to an analog input, then you will either read 0 or 1023 and nothing in between.

You can use the pulseIn() function on any analog or digital input to measure the width of the pulses in microseconds. But then PWM is not the best way to make pulses of specific widths - the servo library can do this much better.

You can filter the PWM signal to provide an analog voltage signal but that's really not worthwhile when you have two digital devices communicating together.

Serial is usually best. See Serial Input Basics (updated)