bleCharacteristic.writeValue() not working for peripheral

Welcome to the forum.

Here are a few comments about your code that might be helpful:

  • The central device cannot call written(). It is a peripheral function that checks whether a central has written to the value of the characteristic.

  • using delay() is a bad practice in most cases, especially when you use communication stacks, time your code with millis(), check the BlinkWithoutDelay example

  • avoid using while, run loop() as often as possible, here is an BLE example of how a peripheral sketch can be written in a cleaner way with handlers for the connection
    https://forum.arduino.cc/t/bluetooth-communications/902610/2

  • initializing variables with some magic numbers is not a good practice

  • I would avoid using rssiState, the term state is usually used with regards to the program e.g., in state machine, I would recommend changing the variable name