Page 199 - MDP2022-3
P. 199

2.  소프트웨어



            #include  <Servo.h>
            Servo  servo_1;
            Servo  servo_2;
            Servo  servo_3;
            Servo  servo_4;
            Servo  servo_5;
            Servo  wrist_1;
            Servo  wrist_2;






            int  flex_1  =  A4;
            int  flex_2  =  A3;
            int  flex_3  =  A2;

            int  flex_4  =  A1;
            int  flex_5  =  A0;
            int  flex_6  =  A8;
            int  flex_7  =  A9;






            void  setup()
            {  servo_1.attach(3);  //중지
                servo_2.attach(2);//검지
                servo_3.attach(6);//약지
                servo_4.attach(5);//새끼
                servo_5.attach(7);//엄지
                wrist_1.attach(10);//손목1
                wrist_2.attach(9);//손목2
                pinMode(13,OUTPUT);
                pinMode(12,OUTPUT);

            }



            void  loop()
            {
                int  flex_1_pos;
                int  flex_2_pos;
                int  flex_3_pos;
                int  flex_4_pos;
                int  flex_5_pos;
                int  flex_6_pos;
                int  flex_7_pos;
   194   195   196   197   198   199   200   201   202   203   204