nihatservis
Üye
- Katılım
- 10 Şub 2014
- Mesajlar
- 1
- Puanları
- 1
- Yaş
- 36
merhaba kolay gelsin. bir ardıuno kodum var ama kodu tamamlayamadım yardımcı olurmusunuz.
yapmak isteğim tam olarak. bir buton basıldığında motor çalışmaya başlayacak switçh geldiğinde yarım saniye duracak aksi yönde çalışmaya başlayacak eski konuma geldiğinde switch görünce duracak. taki tekrar start tuşuna basılana kadar.
kullanılan malzemeler:
ardıuno 1 adet
buton 1 adet
switch 2 adet kuru kontak nc yada no
TB6560 3.5A Step Motor Sürücü 1 adet
nema 23 step motor 1 adet
bir arkadaş yardımcı oldu bir kısmın ı yazdı ama tamamlayamadık.
#include <Stepper.h> //KÜTÜPHANEDEN YÜKLEDİK
int durum = 0 ;
#define buton 13
#define bswıtch 12
#define swıtchb 11
const int stepadimi = 50; // Motor dönüş acısını buradan ayarlıyoruz.
Stepper stepmotor(stepadimi, 8, 9, 10, 11);
void setup() {
pinMode(13, INPUT);
pinMode(12, INPUT);
pinMode(11, INPUT);
digitalWrite(13,LOW) ;
digitalWrite(12,LOW) ;
digitalWrite(11,LOW) ;
stepmotor.setSpeed(60);
}
void loop() {
if(digitalRead(buton)== 1 && durum == 0 )
{
durum == 1
stepmotor.step(stepadimi);
if(digitalRead(bswıtch)==0 && digitalRead(swıtchb)==1 )
{
durum == 2
delay(500);
stepmotor.step(-stepadimi);
}
if(durum == 2 && digitalRead(bswıtch)== 1)
{
/Buraya motoru durduracak kodu yazmanız gerekiyor.
durum = 0
yapmak isteğim tam olarak. bir buton basıldığında motor çalışmaya başlayacak switçh geldiğinde yarım saniye duracak aksi yönde çalışmaya başlayacak eski konuma geldiğinde switch görünce duracak. taki tekrar start tuşuna basılana kadar.
kullanılan malzemeler:
ardıuno 1 adet
buton 1 adet
switch 2 adet kuru kontak nc yada no
TB6560 3.5A Step Motor Sürücü 1 adet
nema 23 step motor 1 adet
bir arkadaş yardımcı oldu bir kısmın ı yazdı ama tamamlayamadık.
#include <Stepper.h> //KÜTÜPHANEDEN YÜKLEDİK
int durum = 0 ;
#define buton 13
#define bswıtch 12
#define swıtchb 11
const int stepadimi = 50; // Motor dönüş acısını buradan ayarlıyoruz.
Stepper stepmotor(stepadimi, 8, 9, 10, 11);
void setup() {
pinMode(13, INPUT);
pinMode(12, INPUT);
pinMode(11, INPUT);
digitalWrite(13,LOW) ;
digitalWrite(12,LOW) ;
digitalWrite(11,LOW) ;
stepmotor.setSpeed(60);
}
void loop() {
if(digitalRead(buton)== 1 && durum == 0 )
{
durum == 1
stepmotor.step(stepadimi);
if(digitalRead(bswıtch)==0 && digitalRead(swıtchb)==1 )
{
durum == 2
delay(500);
stepmotor.step(-stepadimi);
}
if(durum == 2 && digitalRead(bswıtch)== 1)
{
/Buraya motoru durduracak kodu yazmanız gerekiyor.
durum = 0