The motor can be moved by one step at a time, for very fine positioning. The first parameter is the number of ‘steps’ that the motor will take to complete one revolution. To tell the Arduino Stepper library which pins are connected to the motor controller, the following command is used: This makes the process of using a motor very easy.Īfter including the ‘Stepper’ library, the four control pins ‘in1’ to ‘in4’ are defined. Stepper motor(768, in1Pin, in2Pin, in3Pin, in4Pin) Īs you might expect, there is an Arduino library to support stepper motors. Enter -500 and it will turn back in the reverse direction. Try a value of about 500, this should cause the motor to turn through about 360 degrees. The following sketch uses the Serial Monitor, so once the sketch is installed and running, open the Serial Monitor and enter a number of ‘steps’. The Stepper library is included in newer distributions of the Arduino IDE – you may need to upgrade. See the first image how the breadboard connection. Push jumper wires into the sockets to allow the motor to be connected to the breadboard. This means that there are a lot of connections to make on the breadboard. The stepper motor has five leads, and we will be using both halves of the L293D this time. Proximity / TOF / Ultrasonic / PIR / Microwave.Aaccelerometer Magnetometer Gyroscope Barometer Compass.RF Other Protocols Zigbee / Thread / PS2 / Multiple.
0 Comments
Leave a Reply. |