Page 216 - MDP2022-3
P. 216

int send1 = 12;
            int send2 = 13;


            //서보모터 설정

            Servo servo;


            //핀 설정
            void setup() {

              servo.attach(servoPin);
              pinMode(distance, OUTPUT);
              pinMode(echo, INPUT);
              pinMode(trig, OUTPUT);
              pinMode(rx, OUTPUT);



            //시리얼 통신
              pinMode(send1 , OUTPUT);
              pinMode(send2 , OUTPUT);
              Serial.begin(9600);



            //RTOS 설정(우선순위 결정)
              xTaskCreate(
                TaskDcMoter
                ,  "DCMOTER" //  A name just for humans
                ,  128  // Stack size

                ,  NULL // Parameters for the task
                ,  1  // Priority
                ,  NULL );
              xTaskCreate(
                TaskSensor

                ,  "SENSOR" // A name just for humans
                ,  128  // Stack size
                ,  NULL //Parameters for the task
                ,  2  // Priority
                ,  NULL );

            }


            void loop() {}


            //목 움직임

            void neck(int n){ //서보모터 목
              int j=0;
   211   212   213   214   215   216   217   218   219   220   221