소스코드 ▼
더보기
| 마이크로 컨트롤러 - Arduino Mega128 |
| #include <max6675.h> #include <Wire.h> #include <LiquidCrystal_I2C.h> const int stepsPerRevolution = 450; const int stepsPerRevolution2 = 225; const int dirPin = 2; const int stepPin = 3; const int dirPin1 = 4; const int stepPin1 = 5; int mode; int v; int sw = 6; int ktcSO = 8; int ktcCS = 9; int ktcCLK = 10; MAX6675 ktc(ktcCLK, ktcCS, ktcSO); LiquidCrystal_I2C lcd(0x27, 16, 2); void setup() { pinMode(stepPin, OUTPUT); pinMode(dirPin, OUTPUT); pinMode(stepPin1, OUTPUT); pinMode(dirPin1, OUTPUT); pinMode(sw, INPUT_PULLUP); lcd.init(); lcd.backlight(); Serial.begin(9600); delay(200); } void loop() { int t = ktc.readCelsius(); int a = analogRead(A0); // 조이스틱 x축 int y = analogRead(A1); // y축 int z = digitalRead(6); int ff=0; int rr=0; int vv=0; int v=0; Serial.print("a="); Serial.print(a); Serial.print(" "); Serial.print("y="); Serial.print(y); Serial.print(" "); Serial.print("SW= ");Serial.print(z); Serial.println(" "); if(a>650) v|=1; if(a<350) v|=2; if(y>650) v|=4; if(y<350) v|=8; if(z=0) v|=16; switch(v){ case 0: break; //통과 case 1: ff=0; rr=0; vv=1;break; //레일 위 이동 case 2: ff=0; rr=1; vv=0;break; //레알 아래 이동 case 4: ff=1; rr=0; vv=0; break; // 레일 오른쪽이동 case 8: ff=1; rr=0; vv=1; break; // 레일 왼쪽이동 } //레일 아래 이동 if(!ff&&!rr&&vv){ if(mode!=1){ mode=1; digitalWrite(dirPin,LOW); lcd.setCursor(3, 0); lcd.print("DOWN GATE"); for(int x = 0; x < stepsPerRevolution; 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, 0); lcd.print("UP GATE"); for(int x = 0; x < stepsPerRevolution; 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, 0); lcd.print("WAFER OUT"); for(int x = 0; x < stepsPerRevolution; 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, 0); lcd.print("WAFER IN"); for(int x = 0; x < stepsPerRevolution; x++) { digitalWrite(stepPin1, HIGH); delayMicroseconds(1000); digitalWrite(stepPin1, LOW); delayMicroseconds(1000); } delay(500); }} // 그외경우의수 if(t<40){ lcd.setCursor(3, 0); lcd.print("SOFT BAKE"); lcd.setCursor(3, 1); lcd.print("TEMP: "); lcd.print(t + 60); } if(t>40 ){ lcd.setCursor(3, 0); lcd.print("HARD BAKE"); lcd.setCursor(3, 1); lcd.print("TEMP: "); lcd.print(t + 60); } } |
'① 개발 작품 > 교육용 반도체 포토공정 장비' 카테고리의 다른 글
| 교육용 포토공정 장비 - ⑤ 로봇팔 (0) | 2023.02.11 |
|---|---|
| 교육용 포토공정 장비 - ④ UV EXPOSURE (0) | 2023.02.04 |
| 교육용 포토공정 장비 - ② SPIN COATER (0) | 2023.02.04 |
| 교육용 포토 공정 장비 - ① 작동 영상 (0) | 2023.02.04 |
댓글