메뉴 건너뛰기

목록
profile
조회 수 50 댓글 2 예스잼 0 노잼 0

20220302_185550.mp4

 

#include <Servo.h>

 

Servo motor1;

Servo motor2;

 

int servoMotorPin1 = 9;

int servoMotorPin2 = 4;

int potentioMeterPin1 = 0;

int potentioMeterPin2 = 5;

 

int motor1Angle;

int motor2Angle;

int motor1AngleOld;

int motor2AngleOld;

 

int delayTime1 = 20;

int delayTime2 = 20;

 

void setup() {

 

motor1.attach(servoMotorPin1,60,240);

motor2.attach(servoMotorPin2,60,240);

 

  Serial.begin(9600);

}

 

void loop() {

 

  int potentioMeter1=analogRead(potentioMeterPin1);

  int potentioMeter2=analogRead(potentioMeterPin2);

  

  motor1Angle=map(potentioMeter1,0,1023,0,180);

  motor2Angle=map(potentioMeter2,0,1023,0,180);

 

  motor1.write(motor1Angle);

  motor2.write(motor2Angle);

 

  if(motor1Angle != motor1AngleOld){

   Serial.print("서보모터 각도 = ");

   Serial.println(motor1Angle);

  }

  if(motor2Angle != motor2AngleOld){

    Serial.print("ServoMotor angle is = ");

    Serial.println(motor2Angle);

  }

 

  motor1AngleOld = motor1Angle;

  delay(delayTime1);

  motor2AngleOld = motor2Angle;

  delay(delayTime2);

}

 

 

사실상 똑같은 코드 복사한 것 밖에 안되는데,

도선 접촉 불량인지, 보드 문제인지 약간의 신호 충돌이 있는 듯?

 

다음에는 가변저항 역할을 조이스틱이 할 수 있도록

 

음..

  • profile
    삼육두유 2022.03.02 19:23
    두 번째 서보모터 반응 속도가 느린 거였네

    뭐가 문제지
  • profile
    삼육두유 2022.03.02 19:36
    사람 손이라 가정할 시 축이 하나 더 필요한데 조이 스틱으로는 불가능할 것 같으니 대체할 방법도 고려할 것

List of Articles
번호 제목 글쓴이 날짜 조회 수 추천
공지 수용소닷컴 이용약관 file asuka 2020.05.16 1347 1
659 다음주 교수와 박사과정생과 학부연구생과 면담 17 아메 2022.03.08 59 0
658 공부순서 그리드 2022.03.08 43 0
657 코랩 써보고 있는데 질문 좀 5 삼육두유 2022.03.08 54 0
656 인공위성... 9 아메 2022.03.08 55 0
655 이론공부를 해야할거 같아요 ... 그리드 2022.03.07 41 0
654 내일은 진짜 랩실 들어가겠음 4 아야나미레이 2022.03.07 48 0
653 저녁먹고 예제문제 풀겠음 1 그리드 2022.03.05 55 0
652 아두이노 Robotic arm 코드라는데 4 file 삼육두유 2022.03.05 64 0
651 오늘도 컴퓨터 공부중 2 그리드 2022.03.05 55 0
650 원하는대로 수강신청 못함 그리드 2022.03.04 46 0
649 나이 들면서 머리 멍청해진게 느껴짐 2 마루쉐 2022.03.04 72 0
648 qemu 어떻게 쓰는 거임 file 積み 2022.03.04 46 0
647 어쩔랭이라는 것도 있네 ㅋㅋ 積み 2022.03.04 49 0
646 내일 전공 실험실 소자 좀 갖다 써야겠음 삼육두유 2022.03.04 42 0
645 님들 저 좆됨 8 아야나미레이 2022.03.04 45 0
644 앞으로 해볼 것 삼육두유 2022.03.04 38 0
643 머리에 때려박아가면서 이해중 그리드 2022.03.03 41 0
642 백준 풀면 실력 늠?? 5 아야나미레이 2022.03.03 56 0
641 각도 수정 및 뼈대 4 file 삼육두유 2022.03.02 54 0
» 아두이노. 서보모터 한개 추가 2 file 삼육두유 2022.03.02 50 0
목록
Board Pagination Prev 1 ... 19 20 21 22 23 24 25 26 27 28 ... 56 Next
/ 56