Kablo Kesme Makinası

xveb

Üye
Katılım
6 Ocak 2019
Mesajlar
5
Puanları
1
Yaş
35
Arkadaşlar merhaba ardunio konusunda çok iyi sayılmam kendimizce kafa kafa vererek bir makina yapmak istedik bir şeyler yaptık gayet iyi çalışıyor

Devre yi sizlerle paylaşacağım ama bir eklenti isteğim var yapamadım. Kabloyu istediğim boyda kesiyor ama ben kablonun uçlarınıda açtırmak istiyorum.

Senaryo şöyle çalışıyor; Bir step motor suruyor Bir step motor kesiyor.

Senaryo olması istenen; Bir step motor küçük bir adım surecek bekleyecek bir motor yarım makas basacak geri gelecek süren motor belirlenen uzunluk sürecek bekleyecek kesme makası yarım bacak geri gelecek sürme motoru küçük bir adım daha sürecek bekleyecek kesme motoru kesecek döngü bu şekilde devam edecek

bu aşamayı yapmak için araştırma yaptım ama ulaştığım sonuç mevcut kodlara bakarak kod yazmaya dayandı bende bu noktada kaldım malesef yardımcı olacak arkadaşlar varmıdır..

Devre şeması ekte mevcuttur. Ek olarak Ardunio kodlarını paylaşayım sizler senaryoyu anladınız.
Teşekkür ederim..


Kod:
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// Set the LCD address to 0x27 for a 16 chars and 2 line display
LiquidCrystal_I2C lcd(0x27, 16, 2);
#define ok 10
 #define up 12
  #define down 11
 int count = 0;
 int PBdelay = 200;
int state = 0;
int stateA = 0;
int push =0;
int qty =0;
int len = 0;
int countA = 0;
int countB = 0;
int i = 0;

#define feedstepPin 4
#define feeddirPin 3

#define cutstepPin 5
#define cutdirPin 6
float feedsteppermm = 200;
float cutstep = 3200;


void setup()
{
  pinMode (ok,INPUT_PULLUP);
   pinMode (up,INPUT_PULLUP);
   pinMode (down,INPUT_PULLUP);
    pinMode (feedstepPin,OUTPUT);
   pinMode (feeddirPin,OUTPUT);
   pinMode (cutstepPin,OUTPUT);
    pinMode (cutdirPin,OUTPUT);


  
  
   Serial.begin (9600);
    lcd.begin();
    lcd.backlight();

 lcd.clear();
 
}

void loop()

{ 
    
if (!digitalRead(ok)&& state ==0){
  if (push >=3){
  push = 0;
  }
  else{
  push+=1;
 
  }
  delay(PBdelay);
  Serial.println(push);
  lcd.clear();
}

switch (push){
    case 0:
      homescreen();
      break;
    case 1:
    
       setlength();
       break;
    case 2:
      setqty();
      break;
    case 3:
      confirm();
      break;
    case 4:
    finish();
      break;
  }

if (!digitalRead(up)&& stateA ==2){
  countA+=1;
  delay(PBdelay);
   len = countA;
}
if (!digitalRead(down)&& stateA ==2){
  countA-=1;
  delay(PBdelay);
   len = countA;
}


if (!digitalRead(up)&& stateA ==3){
  countB+=1;
  delay(PBdelay);
   qty = countB;
}
if (!digitalRead(down)&& stateA ==3){
  countB-=1;
  delay(PBdelay);
   qty = countB;
}

if (!digitalRead(ok)&& stateA==4){
   lcd.clear();
  push =4;
  int steptotake = len * feedsteppermm *5;
  for (i = 0; i<qty; i++){
 Cutting();
    digitalWrite(feeddirPin,LOW);
    for (unsigned long x = 0; x < steptotake; x++){
      digitalWrite(feedstepPin ,HIGH);
      delayMicroseconds(100);
      digitalWrite(feedstepPin,LOW);
      delayMicroseconds(100);
    }   
    digitalWrite(cutdirPin,HIGH);
for (double y = 0; y < cutstep; y++){
      digitalWrite(cutstepPin ,HIGH);
      delayMicroseconds(100);
     digitalWrite(cutstepPin,LOW);
      delayMicroseconds(100);
    }
 
    
    
 

    
  }



 
}

if (!digitalRead(ok)&& stateA==5){
lcd.clear();
push = 0;
len=0;
qty=0;
countA=0;
countB=0;
delay(PBdelay);
}

  
}
void homescreen(){
 lcd.setCursor(0, 0);
  lcd.print("KESIM MAKINASI ");
  lcd.setCursor(0, 1);
  lcd.print("DANPI   SONRAKI>");
  stateA = 1;

}

void setlength(){
 lcd.setCursor(0, 0);
  lcd.print("UZUNLUK");
  lcd.setCursor(0, 1);
  lcd.print(len);
  lcd.setCursor(4, 1);
  lcd.print("CM");
  lcd.setCursor(8, 1);
  lcd.print("SONRAKI>");
stateA = 2;

}

void setqty(){
 lcd.setCursor(0, 0);
  lcd.print("ADET");
  lcd.setCursor(0, 1);
  lcd.print(qty);
if (qty<2){
lcd.setCursor(4, 1);
  lcd.print("");
}
else{
lcd.setCursor(4, 1);
  lcd.print("");
}

 
  lcd.setCursor(8, 1);
  lcd.print("SONRAKI>");
stateA = 3;

}

void confirm(){
 lcd.setCursor(0, 0);
  lcd.print("UZUNLUK = ");
  lcd.setCursor(9, 0);
  lcd.print(len);
   lcd.setCursor(11, 0);
  lcd.print("CM");
  lcd.setCursor(0, 1);
  lcd.print("ADET = ");
   lcd.setCursor(6, 1);
  lcd.print(qty);
  lcd.setCursor(11, 1);
  lcd.print("TAMAM");
stateA = 4;
}

void Cutting(){
      lcd.setCursor(0, 0);
  lcd.print("KESIYOR ");
  lcd.setCursor(8, 0);
  int k = qty-i;
  if (k==9){
    lcd.clear();
  }
  lcd.print(k);
   lcd.setCursor(11, 0);
  lcd.print("OF " +(String)qty);


}


void finish(){
      

 lcd.setCursor(0, 0);
  lcd.print("BITTI...:)          ");
lcd.setCursor(10, 1);
  lcd.print("MENU>");
  stateA = 5;
}
 

Ekli dosyalar

  • Ardinio Devre Şeması.PNG
    Ardinio Devre Şeması.PNG
    475.4 KB · Görüntüleme: 46

Forum istatistikleri

Konular
128,129
Mesajlar
915,277
Kullanıcılar
449,846
Son üye
g-silver

Yeni konular

Geri
Üst