Transfer anolog signal from a uno arduino to a another

the problem is that I want to transfer a number of pieces by analogWrite to a another arduino which it display the number 00 to 99... I have utilise all of my 14 digital pins on that arduino... but the arduino doesn't red number ... I tried a Serial.print... I'am a beginner... I made a nother program to check if I can display my number and it works

A part of my program of the count

boolean A,B,C,D,E,F,G,a2,B2,C2,D2,E2,F2,G2;
float chiffre;
int dix_exp_un;
int dix_exp_zero;

  void setup(){
  pinMode(0,OUTPUT);
  pinMode(1,OUTPUT);
  pinMode(2,OUTPUT);
  pinMode(3,OUTPUT);
  pinMode(4,OUTPUT);
  pinMode(5,OUTPUT);
  pinMode(6,OUTPUT);
  pinMode(7,OUTPUT);
  pinMode(8,OUTPUT);
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
  pinMode(12,OUTPUT);
  pinMode(13,OUTPUT);
  pinMode(A2, INPUT); // lautre arduino indique le nbre de piece qui reste a usiner
}

void loop(){

chiffre = analogRead(A2/10); 
dix_exp_un = int(chiffre/10); // if we had 79 pieces then base_dix = 7
dix_exp_zero = chiffre-(dix_exp_un)*10;
boolean start, Start, OK, MG, MD,jog_up,aucune_piece_restant_a_usiner, jog_down, haut, bas, monte, descend, piece_plus,piece_moins, man_auto;
boolean reset = 0;
boolean  down =0;
boolean up=0;
int nombre_de_piece_a_usiner;
int piece_usiner;
int p =0;
int piece_restant_a_usiner;

void setup(){
  pinMode(0, INPUT); // MAN /AUTO
  pinMode(1, INPUT); // JOG monte
  pinMode(2, INPUT); // JOG descend
  pinMode(3, INPUT); // start ok pour le nbre de piece
  pinMode(4, INPUT); // bouton gauche
  pinMode(5, INPUT); // bouton droit
  pinMode(6, INPUT); // haut
  pinMode(7, INPUT); // BAS
  pinMode(8, INPUT); // OK
  pinMode(9, INPUT); // nbre de piece a usiner ++
  pinMode(10, INPUT); // nbre de piece a usiner --
  pinMode(11, OUTPUT); // PL pu de piece a faire
  pinMode(12, OUTPUT); // Monte
  pinMode(13, OUTPUT); // Descend
  pinMode(A0, OUTPUT); // indique le nbre de piece a faire a lautre arduino
}

void loop(){
man_auto = digitalRead(0);
jog_up = digitalRead(1);
jog_down = digitalRead(2);
start = digitalRead(3); 
MG = digitalRead(4);
MD = digitalRead(5);
haut = digitalRead(6);
bas = digitalRead(7);
OK = digitalRead(8);
piece_plus = digitalRead(9);
piece_moins = digitalRead(10);

if(MG == 0 && MD == 0 && haut ==0){
   monte = 1;
   }

if(haut == 1 && MG==0 && MD == 0){
  monte = 0;
  descend =0;
  
  if(piece_plus == 1 && piece_moins == 0){
     p = p +1 ;
  }
  
   if(piece_plus == 0 && piece_moins == 1 && p >= 1 ){
     p = p -1;
  }
  
  if( OK == 1){
    nombre_de_piece_a_usiner = p;
  } // on sait maintenant comment de piece on veut usiner
}
if(man_auto == 1){
monte=!descend;
 if(jog_up == 1 && jog_down == 0){
    monte = 1;
    } 
 
 if(jog_up == 0 && jog_down == 1){
    descend = 1;
    }
 if(jog_up == 1 && jog_down == 1){
   reset = 1;
 }
}// mode manuel

if(start == 1){
  Start = 1;
}


 if(Start == 1 && MG==1 && MD == 1 && man_auto == 0 ){
 
  if(piece_restant_a_usiner > 0){
    
   if(haut == 1) { 
      down = 1; // memoire que ca descend
      monte =0;
     }
 
   if(down == 1 && bas == 0){
      descend = 1;
      up = 0;
      }
  

   if(bas == 1){
      descend = 0;
      piece_usiner = piece_usiner + 1;
      up = 1; // memoire que ca monte
     }

   if(up ==1 && haut == 0){
      monte = 1;
      down = 0;
     }
  }//nombre_de_piece_a_usiner > piece_usiner
  
 if(piece_restant_a_usiner == 0){
   aucune_piece_restant_a_usiner = 1;
   reset = 1;
 }
 }// MG et MD == 1
 
if(reset == 1){
  Start = 0;
  piece_restant_a_usiner = 0;
  nombre_de_piece_a_usiner = 0;
  piece_usiner = 0;
  up = 0;
  down =0;
reset =0;
  }


  piece_restant_a_usiner = nombre_de_piece_a_usiner - piece_usiner;

  digitalWrite(11, aucune_piece_restant_a_usiner); // PL pu de piece a faire
  digitalWrite(12, monte); // Monte
  digitalWrite(13, descend); // Descend
  analogWrite(A0, piece_restant_a_usiner*10);
  
}

lab_12_chiffre.ino (3.57 KB)

lab_12_prog.ino (2.78 KB)

You can use Software Serial and use some of the analog pins (A0 to A5 can also be used as D14 to D19) to send serial messages.

the problem is that I want to transfer a number of pieces by analogWrite to a another arduino which it display the number 00 to 99... I have utilise all of my 14 digital pins on that arduino... but the arduino doesn't red number ... I tried a Serial.print... I'am a beginner... I made a nother program to check if I can display my number and it works

What are you trying to do ? What exactly do you mean by "read number" ?
Read number how ? (binary , serial, analog, ? what ?)
Post a schematic and a description of what exactly you are trying to do .
Your explanation above is too vague.

Why are you using AnalogWrite to transfer values ? That doesn't make sense. Use I2C.
You can't use Serial via USB because the USB port is not a HOST port and the UNO serial is tied to the
the USB to serial converter. You can probably use serial to serial if it is TTL (0-5V). You would be better
off using I2C. You CANNOT use AnalogWrite to communicate from one arduino to another unless you
you PULSEIN to read the pulsewidth OR convert the PWM to analog using an RC Low Pass filter and read
it with AnalogRead.
BTW,

(I don't think that code is going to work)

@Crossroads,
True, but I don't think the OP knows about Serial.read()

thanks

Sorry, I think the language is proving to be a barrier. I have no idea what you are trying to say (or do ?)

"a number of pieces.." just doesn't ring any bells with my 30 years of electronics experience.
Do you mean bits ?