Robotic arm

Hi sir, My name is rudra i have red your artical on record and play robotic arm. i could not understood about C_S0_pos, please tell me about that. 

   if (P_S0_pos == S0_pos) //If 1st and 2nd value are same
   {
    Servo_0.write(S0_pos); //Control the servo
    
    if (C_S0_pos != S0_pos) //If the POT has been turned 
    {
      saved_data[array_index] = S0_pos + 0; //Save the new position to the array. Zero is added for zeroth motor (for understading purpose)
      array_index++; //Increase the array index 
    }
    
    C_S0_pos = S0_pos; //Saved the previous value to check if the POT has been turned 
   }

I assume is doubt is with the above snippet of code in the project Record and Play Arduino ARM

https://circuitdigest.com/microcontroller-projects/record-and-play-3d-p…

 

We are saving the values of pot in a array called saved_data during record mode. But we should push a value into this array only if the pot value has changed. Else we will save the same in the array again and again. 

So we check if the POT value is different from the previous value and only if it is different the new value is pushed into the array. The previous value is saved in the variable C_S0_pos and the new value will be in S0_pos

  Joined August 16, 2016      1000
Tuesday at 12:29 AM