serial print get strange numbers


hey friends
i try see values ??but strange numbers
can tell me mistake



quote
//in program tray control robotic hans 20 dof
//this program control 20  servo motors (one each dof) need mimic perllal control  movement closly posable life like
#include <servo.h> //including library servo motors

struct finger { //creating new type of verable name finger contains 4 motor 1 each dof of finger
    servo distal;
    servo middle;
    servo proxi;
    servo connplat;
};

//diclartion of functions
void positions();

void move_hand(int pos[3][5]);

void finger_move(struct finger fingerverable,int factor, int angle, int side);

//set global variables

  finger thumb;
  finger index;
  finger middle;
  finger ring;
  finger pinky;

void setup()
{   serial.begin(9600);
   int pos;
   
   
 
      //setting connections arduino
      thumb.distal.attach(1);
      thumb.middle.attach(2);
      thumb.proxi.attach(3);
      thumb.connplat.attach(4);
      //
         index.distal.attach(5);
         index.middle.attach(6);
         index.proxi.attach(7);
         index.connplat.attach(8);
      //
            middle.distal.attach(9);
            middle.middle.attach(10);
            middle.proxi.attach(11);
            middle.connplat.attach(12);
      //
                  ring.distal.attach(13);
                  ring.middle.attach(14);
                  ring.proxi.attach(15);
                  ring.connplat.attach(16);
      //
                     pinky.distal.attach(17);
                     pinky.middle.attach(18);
                     pinky.proxi.attach(19);
                     pinky.connplat.attach(20);
}
void loop()// main function calls positions functions
{
      positions();



}

void positions()//this function contains verables of many positions whant show , loop displaying 1 after other
{
   serial.println("------------------------------------positions--------------------------------");
serial.println("------------------------------------positions--------------------------------");
serial.println("------------------------------------positions--------------------------------");
serial.println("------------------------------------positions--------------------------------");
      int num=0;// verable switch case

        int 0 [3][5]  = { { 90,40,60,30,90},{ 0, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                  /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
        int tip [3][5]   = { { 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                   /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
        int hook [3][5]  = { { 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                  /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
         int palmar[3][5] = {{ 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                           /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
         int spheical[3][5] = {{ 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                  /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
        int lateral[3][5] = {{ 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                  /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
        int cylindr[3][5] = {{ 60,40,60,30,90},{ 3, 4, 2,1, 7},{0 , 1,0, 0, 0} } ;
                                                  /*=====================
                     |angle |60|40|60|30|90|
                     =======================
                     |factor| 3| 4| 2|1 | 7|
                     =======================
                     |side  |0 | 1| 0| 0| 0|
                     =======================*/
       serial.print('zero [3][5]',dec);
serial.println("tip [3][5]");
  serial.println("hook [3][5]");
   serial.println("palmar[3][5]");

        while (num!=7)// display loop
        {   
           serial.println("zero");   
           move_hand(zero); //call function "move_hand" , send position need
           num++; //increase veriable "num"
         
           serial.println("tip");
           move_hand(tip);//call function "move_hand" , send position need
            num++; //increase veriable "num"
         
           serial.println("lateral");
           move_hand( lateral);//call function "move_hand" , send position need
           num++; //increase veriable "num"
         
           serial.println("palmar");
           move_hand( palmar);//call function "move_hand" , send position need
           num++; //increase veriable "num"
         
           serial.println("palmar");
           move_hand( hook);//call function "move_hand" , send position need
           num++; //increase veriable "num"
         
           serial.println("palmar");
            move_hand(spheical);//call function "move_hand" , send position need
           num++; //increase veriable "num"
         
           serial.println("palmar");
           move_hand(cylindr);//call function "move_hand" , send position need
           num++; //increase veriable "num"
         

         }


}


void move_hand(int pos[3][5])
{ serial.println(" move_hand");
  finger fingername=pinky;
  int fing=1;// verable switch case
  int collector[5];// verable run on colloms
  int col;//verable colloms

  while(1)
  {
     if(col==5 && (collector[col]==pos[2][col]))
        break;
        while(collector[col]!=pos[2][col])
        {
       
         fingername = thumb;
         serial.println(" thumb");
         serial.print ('fingername');
         fing++;
         finger_move(fingername,pos[0][col],collector[col],pos[2][col]);
         collector[col]=+1;
         col++;

         fingername = index;
         serial.println(" index");
         serial.println('fingername');
         fing++;
         finger_move(fingername,pos[0][col],collector[col],pos[2][col]);
         collector[col]=+1;
         col++;

         fingername = middle;
         serial.println(" middle");
         serial.println('fingername');
         fing++;
         finger_move(fingername,pos[0][col],collector[col],pos[2][col]);
         collector[col]=+1;
         col++;

         fingername = ring;
         serial.println(" ring");
         serial.println('fingername');
         fing++;
         finger_move(fingername,pos[0][col],collector[col],pos[2][col]);
         collector[col]=+1;
         col++;

         fingername = pinky;
         serial.println(" pinky");
         serial.println('fingername');
         fing=0;
         finger_move(fingername,pos[0][col],collector[col],pos[2][col]);
         collector[col]=+1;
         col++;
           }
        }
    
     if(col>5)
        col=0;
  }



void finger_move(struct finger fingerverable,int factor, int angle, int side)
{  delay(1000);
   serial.println(" finger_move");
   //serial.print(fingerverable);
   serial.print(factor, dec);
    serial.print(factor);
   serial.println(" -----------");
   serial.println('angle');
   serial.println('side');
   fingerverable.distal.write(angle);
   fingerverable.middle.write(angle/factor);
   fingerverable.proxi.write(angle);
   fingerverable.connplat.write(angle/side);
 
   
}





you need clean , put in code tags. # in tool bar above the smily faces.


Arduino Forum > Using Arduino > Programming Questions > serial print get strange numbers


arduino

Comments

Popular posts from this blog

Convierte tu Raspberry en un NAS. Firmware fvdw-sl 15.3 - Raspberry Pi Forums

How to format a Get Request

avrdude: verification error, first mismatch at byte 0x0000 0x0c != 0x62