Page 219 - MDP2022-3
P. 219

servo.write(75);
                    digitalWrite(in1,1);
                    digitalWrite(in2,0);
                    digitalWrite(in3,1);

                    digitalWrite(in4,0);
                    analogWrite(ena, 100);
                    vTaskDelay(1);
                    analogWrite(enb, 50);

                    vTaskDelay(500);
                   break;
                   case 3://dc모터 좌회전
                      servo.write(75);
                      digitalWrite(in1,1);
                      digitalWrite(in2,0);

                      digitalWrite(in3,1);
                      digitalWrite(in4,0);
                      analogWrite(ena, 50);
                      vTaskDelay(1);
                      analogWrite(enb, 100);

                      vTaskDelay(500);
                   break;
                   case 4:// dc모터 정지
                      if(stp!=1){
                        servo.write(75);

                      }
                      digitalWrite(in1,1);
                      digitalWrite(in2,1);
                      digitalWrite(in3,1);
                      digitalWrite(in4,1);

                      analogWrite(ena, 0);
                      analogWrite(enb, 0);
                   break;


                }

              }
            }
   214   215   216   217   218   219   220   221   222   223   224