Page 220 - MDP2022-3
P. 220

//서보 모터--------------------------------------------------------------------------------------
            //값 받아서 직진 좌우회전 정지 시늉만
            #include <Arduino_FreeRTOS.h>

            #include <Servo.h>
            #include <SoftwareSerial.h>
            SoftwareSerial use(0,1);



            //핀 번호 설정
            int sen = 0;
            int ser[10] = {0,0,0,0,0,0,0,0,0,0};
            int turn = 0;
            int servoPin0 = 9;
            int servoPin1 = 10;

            int servoPin2 = 11;
            int servoPin3 = 12;
            int tx = 1;
            int a=0;
            int flag=0;

            int st = 0;
            int re1 = 6;
            int re2 = 7;


            //서보모터 설정

            Servo servo0;
            Servo servo1;
            Servo servo2;
            Servo servo3;



            // 핀 설정
            void setup() {
              servo0.attach(servoPin0);
              servo1.attach(servoPin1);
              servo2.attach(servoPin2);

              servo3.attach(servoPin3);
              pinMode(re1 , INPUT);
              pinMode(re2 , INPUT);


            //시리얼 통신

              Serial.begin(9600);
              Serial.println("Run!");
              pinMode(tx, INPUT);
   215   216   217   218   219   220   221   222   223   224   225