
+++ TEST
... | ... | @@ -0,0 +1,76 @@ |
1 | +test motor with arduino, check hallsensor | |
2 | + | |
3 | +- test run motor with arduino | |
4 | +''' | |
5 | +const int PWM = 10; // MD200T 6번 (SPEED_IN2) 노랑 | |
6 | +const int DIR = 8; // MD200T 2번 (DIR2) 주황 | |
7 | +const int ST = 9; // MD200T 4번 (START/STOP2) 초록 | |
8 | + | |
9 | +void setup() { | |
10 | + Serial.begin(9600); | |
11 | + | |
12 | + pinMode(PWM, OUTPUT); | |
13 | + pinMode(DIR, OUTPUT); // 회전 방향 (시계 방향 = HIGH) | |
14 | + pinMode(ST, OUTPUT); // 브레이크 (해제 = LOW) | |
15 | + | |
16 | + digitalWrite(ST, HIGH); | |
17 | + delay(2000); // 전원 안정화 | |
18 | +} | |
19 | + | |
20 | +void loop() { | |
21 | + | |
22 | + digitalWrite(ST, LOW); // 브레이크 해제 | |
23 | + digitalWrite(DIR, LOW); // 반시계 회전 | |
24 | + analogWrite(PWM, 0); | |
25 | + // delay(10000); | |
26 | + // digitalWrite(ST, HIGH); // 멈춤 | |
27 | + // delay(4000); | |
28 | + | |
29 | + // digitalWrite(ST, LOW); | |
30 | + // digitalWrite(DIR, HIGH); // 시계 회전 | |
31 | + // analogWrite(PWM, 125); | |
32 | + // delay(10000); | |
33 | + // digitalWrite(ST, HIGH); | |
34 | + // delay(4000); | |
35 | +} | |
36 | +''' | |
37 | + | |
38 | +- check hallsensor | |
39 | + | |
40 | +''' | |
41 | +// 홀센서 핀 번호 | |
42 | +const int Hu = 4; | |
43 | +const int Hv = 3; | |
44 | +const int Hw = 2; | |
45 | + | |
46 | +const int PWM = 10; // MD200T 6번 (SPEED_IN2) 노랑 | |
47 | +const int DIR = 8; // MD200T 2번 (DIR2) 주황 | |
48 | +const int ST = 9; // MD200T 4번 (START/STOP2) 초록 | |
49 | + | |
50 | +void setup() { | |
51 | + Serial.begin(9600); | |
52 | + | |
53 | + pinMode(Hu, INPUT); | |
54 | + pinMode(Hv, INPUT); | |
55 | + pinMode(Hw, INPUT); | |
56 | + | |
57 | + pinMode(PWM, OUTPUT); | |
58 | + pinMode(DIR, OUTPUT); // 회전 방향 (시계 방향 = HIGH) | |
59 | + pinMode(ST, OUTPUT); | |
60 | + digitalWrite(ST, HIGH); // 브레이크 (해제 = LOW) | |
61 | + delay(2000); // 전원 안정화 | |
62 | +} | |
63 | + | |
64 | +//모터를 직접 손으로 돌리면서 체크 | |
65 | +void loop() { | |
66 | + int hu = digitalRead(Hu); | |
67 | + int hv = digitalRead(Hv); | |
68 | + int hw = digitalRead(Hw); | |
69 | + | |
70 | + Serial.print("Hu: "); Serial.print(hu); | |
71 | + Serial.print(" | Hv: "); Serial.print(hv); | |
72 | + Serial.print(" | Hw: "); Serial.println(hw); | |
73 | + | |
74 | + delay(200); // 0.2초 간격 출력 | |
75 | +} | |
76 | +'''(파일 끝에 줄바꿈 문자 없음) |
Add a comment
Delete comment
Once you delete this comment, you won't be able to recover it. Are you sure you want to delete this comment?