This is the 6th phase in the making of our autonomous Biotronics Lego Walker. In this phase a stepper motor 28BYJ-48 5V with a ULN2003 driver board is added on the robot's microcontroller. The Lawsin Linkage is also used in this experimental model.
This Biotronics project is made up of an Arduino Uno microcontroller, ultrasonic sensor HC-05 , an LED indicator, a piezo speaker, a microservo motor SG90 , a stepper motor 28BYJ-48, one power function, and LEGO's bricks and pieces.
Phase 6: Stepper Motor 28BYJ-48 Sketch
/////////////////////////////////////////////////////////////////////////////////////////////////
/*
Stepper Motor Test
This is the 6th phase of The Biotronics Lego Project.
This sketch test a geared stepper motor on Arduino Uno.
The motor will revolve one revolution forward then backward.
The motor is attached to digital pins 8 - 11.
Sketched by J.B.Wylzan
*/
int i=0;
int m=4;
void setup() {
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);
pinMode(11, OUTPUT);
}
void loop()
{
for(i=0;i<512;i++)
{
forward();
}
delay(1000);
for(i=0;i<512;i++)
{
backward();
}
delay(1000);
}
void forward()
{
step1();
step2();
step3();
step4();
step5();
step6();
step7();
step8();
}
void backward()
{
step8();
step7();
step6();
step5();
step4();
step3();
step2();
step1();
}
void step1()
{
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
delay(m);
}
void step2()
{
digitalWrite(8, HIGH);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
delay(m);
}
void step3()
{
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, LOW);
digitalWrite(11, LOW);
delay(m);
}
void step4()
{
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
delay(m);
}
void step5()
{
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, LOW);
delay(m);
}
void step6()
{
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, HIGH);
digitalWrite(11, HIGH);
v
}
void step7()
{
digitalWrite(8, LOW);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
delay(m);
}
void step8()
{
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
digitalWrite(10, LOW);
digitalWrite(11, HIGH);
delay(m);
}
/////////////////////////////////////////////////////////////////////////////////
*Biotronics are robots in forms of insects, animals, and plants that look alive or with life. The word was coined by Lawsin in his book Creation by Laws. In technical term, Biotronics is the science of robots with self consciousness. Bio means life and tronics means intelligent electronics(neurotronics).

No comments:
Post a Comment