NRF24l01 with servo

Hey,
so I wanted to send a value e.g. 160° from one arduino to another, so that the second arduino operates with that 160°. However I dont know how to do it and on the internet i cant seem to find any answers rlated to my problem.

My code so far:

Transmitter:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
bool radioNumber = 0;
int val = 90;
RF24 radio(9, 10); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
void setup() {
  Serial.begin(9600);
  radio.begin();
  radio.openWritingPipe(addresses[1]); // 00001
  radio.openReadingPipe(1, addresses[0]); // 00002
  radio.setPALevel(RF24_PA_LOW);
  
  radio.stopListening();
}
void loop() {
  
  if(Serial.available()){
  val = Serial.parseInt(); 
  }
  Serial.println(val);
  radio.write(val, sizeof(val));
  delay(50);
  }

Receiver:

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Servo.h>
int val = 160;
RF24 radio(2, 3); // CE, CSN
const byte addresses[][6] = {"00001", "00002"};
Servo myServo;
bool radioNumber = 1;
void setup() {
  Serial.begin(9600);
 
  myServo.attach(8);
  radio.begin();
  radio.openWritingPipe(addresses[0]); // 00002
  radio.openReadingPipe(1, addresses[1]); // 00001
  radio.setPALevel(RF24_PA_LOW);
  radio.startListening();
}
void loop() {
 
  if ( radio.available()) {
    
      radio.read(val, sizeof(val));
      myServo.write(val);
      Serial.println(val);
    }
  }

So what happens when you run the programs ?
What do you see on the Serial monitor of the receiver ?

well the motor obiously runs at 160 and in the serial monitor there is spammed 160 all the time, but when i type like 120 in the transmitter serial, it still stays at 160

Try the first example in this Simple nRF24L01+ Tutorial

And if you want to explore your own code I suggest you change delay(50) to delay(1000) - at least for initial testing.

...R

For starters you should not initiate duplex communication, only open the radio for writing in the transmitter and only for reading in the receiver - both using the same address.