Tải bản đầy đủ - 0 (trang)
digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(8,LOW);//dir chieu dong co

Tải bản đầy đủ - 0trang

digitalWrite(6,HIGH);//xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void len2(){

//300mm

for(int a=0;a<=120000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,HIGH);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quaphai2(){

//387.5mm

for(long i=0;i<=155000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);//enb mo nguon

digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(6,HIGH);//step xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

49



}

void xuong2(){

//250mm

for(int a=0;a<=100000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,LOW);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quatrai3(){

//337.5mm

for(long i=0;i<=135000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);// mo nguon

digitalWrite(8,HIGH);//chieu dong co

digitalWrite(6,HIGH);//xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void len3(){

//250mm

for(int a=0;a<=100000;a++)

{

50



//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,HIGH);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quaphai3(){

//337.5mm

for(long i=0;i<=135000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);//enb mo nguon

digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(6,HIGH);//step xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void xuong3(){

//200mm

for(int a=0;a<=80000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,LOW);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

51



digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quatrai4(){

//287.5mm

for(long i=0;i<=115000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);// mo nguon

digitalWrite(8,HIGH);//chieu dong co

digitalWrite(6,HIGH);//xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void len4(){

//200mm

for(int a=0;a<=80000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,HIGH);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quaphai4(){

52



//287.5

for(long i=0;i<=115000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);//enb mo nguon

digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(6,HIGH);//step xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void xuong4(){

//150mm

for(int a=0;a<=60000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,LOW);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quatrai5(){

//237.5mm

for(long i=0;i<=95000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);// mo nguon

53



digitalWrite(8,HIGH);//chieu dong co

digitalWrite(6,HIGH);//xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void len5(){

//150mm

for(int a=0;a<=60000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,HIGH);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quaphai5(){

//237.5

for(long i=0;i<=95000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);//enb mo nguon

digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(6,HIGH);//step xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

54



}

}

void xuong5(){

//100mm

for(int a=0;a<=40000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,LOW);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quatrai6(){

//187.5mm

for(long i=0;i<=75000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);// mo nguon

digitalWrite(8,HIGH);//chieu dong co

digitalWrite(6,HIGH);//xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void len6(){

//100mm

for(int a=0;a<=40000;a++)

55



{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,HIGH);//dir

digitalWrite(5,HIGH);//xung

delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void quaphai6(){

//187.5

for(long i=0;i<=75000;i++)

{

//digitalWrite(10,HIGH);

digitalWrite(7,LOW);//enb mo nguon

digitalWrite(8,LOW);//dir chieu dong co

digitalWrite(6,HIGH);//step xung

delayMicroseconds(50);

digitalWrite(6,LOW);//xung

delayMicroseconds(30);

}

}

void xuong6(){

//50mm

for(int a=0;a<=20000;a++)

{

//digitalWrite(7,HIGH);

digitalWrite(9,LOW);//enb

digitalWrite(4,LOW);//dir

digitalWrite(5,HIGH);//xung

56



delayMicroseconds(150);

digitalWrite(5,LOW);//xung

delayMicroseconds(150);

}

}

void tien(){

for (int x=0;x<=10000;x++){

digitalWrite(12,LOW);

digitalWrite(13,LOW);//dir

digitalWrite(10,HIGH);

delayMicroseconds(100);

digitalWrite(10,LOW);

delayMicroseconds(100);

}

}

void lui(){

for (int x=0;x<=10000;x++){

digitalWrite(12,LOW);

digitalWrite(13,HIGH);//dir

digitalWrite(10,HIGH);

delayMicroseconds(100);

digitalWrite(10,LOW);

delayMicroseconds(100);

}

}

void loop() {

tien();

digitalWrite(2,0);

quatrai1();

len1();

quaphai1();

57



xuong1();

quatrai2();

len2();

quaphai2();

xuong2();

quatrai3();

len3();

quaphai3();

xuong3();

quatrai4();

len4();

quaphai4();

xuong4();

quatrai5();

len5();

quaphai5();

xuong5();

quatrai6();

len6();

quaphai6();

xuong6();

digitalWrite(7,HIGH);

digitalWrite(9,HIGH);

digitalWrite(12,HIGH);

digitalWrite(2,1);

delay(10000);

}



58



Tài liệu bạn tìm kiếm đã sẵn sàng tải về

digitalWrite(8,LOW);//dir chieu dong co

Tải bản đầy đủ ngay(0 tr)

×