소스코드 ▼
더보기
| 마이크로 컨트롤러 - Arduino Mega128 |
| #include <LiquidCrystal_I2C.h> int mode; int v; const int stepsPerRevolution = 450; const int stepsPerRevolution2 = 225; const int dirPin = 2; const int stepPin = 3; const int dirPin1 = 4; const int stepPin1 = 5; const int dirPin2 = 6; const int stepPin2 = 7; int sw = 8; int sw1 = 9; int button = 10; int IN3=11; int IN4=12; int button2 = 13; LiquidCrystal_I2C lcd(0x27, 16, 2); void setup(){ pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); pinMode(stepPin1, OUTPUT); pinMode(dirPin1, OUTPUT); pinMode(stepPin2, OUTPUT); pinMode(dirPin2, OUTPUT); pinMode(sw, INPUT_PULLUP); pinMode(sw1, INPUT_PULLUP); pinMode(button, INPUT); pinMode(button2, INPUT); pinMode(IN3,OUTPUT); pinMode(IN4,OUTPUT); lcd.init(); lcd.backlight(); Serial.begin(9600); delay(200); } void loop(){ int a = analogRead(A0); int y = analogRead(A1); int z = digitalRead(8); int y1 = analogRead(A2); int a1 = analogRead(A3); int z1 = digitalRead(9); Serial.print("a="); Serial.print(a); Serial.print(" "); Serial.print("y="); Serial.print(y); Serial.print(" "); Serial.print("SW= "); Serial.print(z); Serial.println(" "); Serial.print("a1="); Serial.print(a1); Serial.print(" "); Serial.print("y1="); Serial.print(y1); Serial.print(" "); Serial.print("SW1= "); Serial.print(z1); Serial.println(" "); int v=0; if(a>650) v|=1; if(a<350) v|=2; if(y>650) v|=4; if(y<350) v|=8; if(digitalRead(button2) == LOW) v|=16; if(a1>650) v|=32; if(a1<350) v|=64; if(y1>800) v|=128; if(y1<200) v|=256; if(digitalRead(button) == LOW) { lcd.setCursor(3, 1); lcd.print("UV LIGHT."); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); digitalWrite(IN3,HIGH); delay(3000); digitalWrite(IN3,LOW); } int ff=0; int rr=0; int vv=0; int bb=0; int ss=0; int dd=0; switch(v){ case 0: break; //통과 case 1: ff=1; rr=0; vv=0; break; //레일 위 이동 case 2: ff=1; rr=0; vv=1; break; //레알 아래 이동 case 4: ff=0; rr=0; vv=1; break; // 레일 오른쪽이동 case 8: ff=0; rr=1; vv=0; break; // 레일 왼쪽이동 case 32: ff=1; rr=1; vv=0; break; case 64: ff=1; rr=1; vv=1; break; case 128: bb=1; ss=0; dd=0;break; case 256: bb=1; ss=1; dd=0;break; case 16: bb=1; ss=0; dd=1;break; break; case 5: break; case 6: break; case 9: break; case 10: break; case 12: break; case 33: break; case 34: break; case 36: break; case 65: break; case 66: break; case 68: break; } //레알 위 이동 if(!ff&&!rr&&vv){ if(mode!=1){ mode=1; digitalWrite(dirPin, LOW); lcd.setCursor(3, 1); lcd.print("WAFER LLL"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } delay(500); } } //레일 아래 이동 if(!ff&&rr&&!vv){ if(mode!=2){ mode=2; digitalWrite(dirPin,HIGH); lcd.setCursor(3, 1); lcd.print("WAFER RRR"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } delay(500); } } // 레일 오른쪽이동 if(ff&&!rr&&!vv){ if(mode!=3){ mode=3; digitalWrite(dirPin1, HIGH); lcd.setCursor(3, 1); lcd.print("WAFER OUT"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } delay(500); } } // 레일 왼쪽이동 if(ff&&!rr&&vv){ if(mode!=4){ mode=4; digitalWrite(dirPin1, LOW); lcd.setCursor(3, 1); lcd.print("WAFER IN"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } delay(500); } } // 레일 위이동 if(ff&&rr&&!vv){ if(mode!=5){ mode=5; digitalWrite(dirPin2, LOW); lcd.setCursor(3, 1); lcd.print("GATE DOWN"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin2, HIGH); delayMicroseconds(1000); digitalWrite(stepPin2, LOW); delayMicroseconds(1000); } delay(500); } } // 레일 아래이동 if(ff&&rr&&vv){ if(mode!=6){ mode=6; digitalWrite(dirPin2, HIGH); lcd.setCursor(3, 1); lcd.print("GATE UP"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin2, HIGH); delayMicroseconds(1000); digitalWrite(stepPin2, LOW); delayMicroseconds(1000); } delay(500); } } // A if(bb&&!ss&&!dd){ if(mode!=7){ mode=7; lcd.setCursor(3, 1); lcd.print("ALLIGN LL"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); digitalWrite(dirPin, LOW); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } digitalWrite(dirPin1, LOW); for(int x = 0; x < stepsPerRevolution2; x++) {digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } digitalWrite(dirPin, HIGH); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } }} // B if(bb&&ss&&!dd){ if(mode!=8){ mode=8; digitalWrite(dirPin2, HIGH); lcd.setCursor(3, 1); lcd.print("ALLIGN RR"); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); digitalWrite(dirPin, HIGH); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } digitalWrite(dirPin1, LOW); for(int x = 0; x < stepsPerRevolution2; x++) {digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } digitalWrite(dirPin, LOW); for(int x = 0; x < stepsPerRevolution2; x++) { digitalWrite(stepPin, HIGH); delayMicroseconds(1000); digitalWrite(stepPin, LOW); delayMicroseconds(1000); } delay(500); } } // FINISH if(bb&&!ss&&dd){ if(mode!=9){ mode=9; lcd.setCursor(3, 1); lcd.print("...FINISH.."); lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); digitalWrite(dirPin1, HIGH); for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } delay(500); } } lcd.setCursor(3, 1); lcd.print("..WAITING..") ; lcd.setCursor(2, 0); lcd.print("[UV PROCESS]"); } |
'① 개발 작품 > 교육용 반도체 포토공정 장비' 카테고리의 다른 글
| 교육용 포토공정 장비 - ⑤ 로봇팔 (0) | 2023.02.11 |
|---|---|
| 교육용 포토공정 장비 - ③ HARD/SOFT BAKE (0) | 2023.02.04 |
| 교육용 포토공정 장비 - ② SPIN COATER (0) | 2023.02.04 |
| 교육용 포토 공정 장비 - ① 작동 영상 (0) | 2023.02.04 |
댓글