Using and assigning a variable to values sent over bluetooth

I’ve spent hours trying to figure this out.

So, the main goal of this is to use the values sent over Bluetooth to determine the brightness of a LED however, I am having trouble actually using the values sent over. When I try to assign the values sent over to a variable (using “a=BTserial.read();”) and then print them in my serial monitor they come out as nonsensical symbols.

I hope to control the LED brightness with PWm determined by if statements with conditions depending on the value transmitted in the end, but currently I am just using digital write to test the code and ensure the value is being assigned properly.

If someone could direct me to the proper way to use and assign the values transmitted, it would be greatly appreciated.

Thanks.
Edit: The value being sent over is the reading from a phototransistor and consists of an integer

// HC-06
#include <AltSoftSerial.h>
AltSoftSerial BTserial;
//int LED1=11;
//int LED2=10;
//int LED3=3;
int a;

int val;
//#include <SoftwareSerial.h>  Irrelevant code due to use of different library
//SoftwareSerial BTSerial(2, 3); // RX | TX Irrelevant code due to use of different library
//SoftwareSerial BTserial(9, 8); // RX | TX Irrelevant code due to use of different library
void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino with HC-06 is ready");
 
    // HC-06 default baud rate is 9600
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
}
 
void loop()
{
  // Keep reading from HC-06 and send to Arduino Serial Monitor
  if (BTserial.available())
    {Serial.write(BTserial.read());
    a=BTserial.read();
    }
  // Keep reading from Arduino Serial Monitor and send to HC-06
  if (Serial.available())
 { BTserial.write(Serial.read());
 }
 Serial.write(a);
/*
if (a>=60){
  val=0;
}
if (a>=55 && a<60){
  val=20;
}
if (a>=50 && a<55){
  val=40;
}
if (a>=45 && a<50){
  val=60;
}
if ((a>=40) && (a<45)){
  val=80;
}
if ((a>=35) && (a<40)){
  val=100;
}
if ((a>=30) && (a<35)){
  val=120;
}
if ((a>=25) && (a<30)){
  val=140;
}
if ((a>=20) && (a<25)){
  val=160;
}
if ((a>=15) && (a<20)){
  val=180;
}
if ((a>=10) && (a<15)){
  val=205;
}
if ((a>=5) && (a<10)){
  val=235;
}
if ((a>=0) && (a<5)){
  val=255;
}
else{
  val=0;
}
*/
if (a>30){
  digitalWrite(11,HIGH);
}
else{
  digitalWrite(11,LOW);
}

//analogWrite(11,val);
//analogWrite(10,val);
//analogWrite(3,val);
}

Code for arduino sending the value.

#include <stdint.h>
 #include <AltSoftSerial.h>
AltSoftSerial BTserial;
int pR=A1; 
int charac=" ";
int value=0; 
int v2;
char c = " ";
 
void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino with HC-05 is ready");
 
    // start communication with the HC-05 using 9600
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
    
}
 
void loop()
{
 
     // Keep reading from HC-05 and send to Arduino Serial Monitor
    if (BTserial.available())
    {  
        c = BTserial.read();
        Serial.write(c);
    }
 
    // Keep reading from Arduino Serial Monitor and send to HC-05
    if (Serial.available())
    {
        c =  Serial.read();
        BTserial.write(c);  
    }

value = analogRead(pR);

BTserial.println(value);
}[CODE]

[/code]

New code for sending and receiving. I changed it in order to make the sent value only one character in an attempt to make it work however, I had no luck.

Sending:

#include <stdint.h>
 #include <AltSoftSerial.h>
AltSoftSerial BTserial;
int pR=A1; 
int charac=" ";
int value=0; 
int v2;
char c = " ";
int val;
 
void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino with HC-05 is ready");
 
    // start communication with the HC-05 using 9600
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
    
}
 
void loop()
{
 delay(200);
     // Keep reading from HC-05 and send to Arduino Serial Monitor
    if (BTserial.available())
    {  
        c = BTserial.read();
        Serial.write(c);
    }
 
    // Keep reading from Arduino Serial Monitor and send to HC-05
    if (Serial.available())
    {
        c =  Serial.read();
        BTserial.write(c);  
    }

value = analogRead(pR);
if (value>=60){
  val=0;
}
if (value>=53 && value<60){
  val=1;
}
if (value>=45 && value<53){
  val=2;
}
if (value>=38 && value<45){
  val=3;
}
if ((value>=31) && (value<38)){
  val=4;
}
if ((value>=24) && (value<31)){
  val=5;
}
if ((value>=17) && (value<24)){
  val=6;
}
if ((value>=10) && (value<17)){
  val=7;
}
if ((value>=0) && (value<10)){
  val=8;
}


BTserial.println(val);
}

Recieving

// HC-06
#include <AltSoftSerial.h>
AltSoftSerial BTserial;
//int LED1=11;
//int LED2=10;
//int LED3=3;
int a;

int val;
//#include <SoftwareSerial.h>  Irrelevant code due to use of different library
//SoftwareSerial BTSerial(2, 3); // RX | TX Irrelevant code due to use of different library
//SoftwareSerial BTserial(9, 8); // RX | TX Irrelevant code due to use of different library
void setup() 
{
    Serial.begin(9600);
    Serial.println("Arduino with HC-06 is ready");
 
    // HC-06 default baud rate is 9600
    BTserial.begin(9600);  
    Serial.println("BTserial started at 9600");
}
 
void loop()
{
  // Keep reading from HC-06 and send to Arduino Serial Monitor
  if (BTserial.available())
    {Serial.write(BTserial.read());
    //a=Serial.read();
    }
  // Keep reading from Arduino Serial Monitor and send to HC-06
  if (Serial.available())
 { BTserial.write(Serial.read());
 }
/*
if (a>=60){
  val=0;
}
if (a>=55 && a<60){
  val=20;
}
if (a>=50 && a<55){
  val=40;
}
if (a>=45 && a<50){
  val=60;
}
if ((a>=40) && (a<45)){
  val=80;
}
if ((a>=35) && (a<40)){
  val=100;
}
if ((a>=30) && (a<35)){
  val=120;
}
if ((a>=25) && (a<30)){
  val=140;
}
if ((a>=20) && (a<25)){
  val=160;
}
if ((a>=15) && (a<20)){
  val=180;
}
if ((a>=10) && (a<15)){
  val=205;
}
if ((a>=5) && (a<10)){
  val=235;
}
if ((a>=0) && (a<5)){
  val=255;
}
else{
  val=0;
}
*/
if (a=0){
  val=0;
}
if (a=1){
  val=30;
}
if (a=2){
  val=60;
}
if (a=3){
  val=90;
}
if (a=4){
  val=120;
}
if (a=5){
  val=150;
}
if (a=6){
  val=190;
}
if (a=7){
  val=255;
}
if (a=8){
  val=255;
}

/*
if (a>30){
  digitalWrite(11,HIGH);
}
else{
  digitalWrite(11,LOW);
}
*/
analogWrite(11,val);
analogWrite(10,val);
analogWrite(3,val);
}