Stepper motor 28byj48 Shared Library

8 2231
Edited by swipon at Jan 12, 2016 04:12

I'm trying to write a shared library to simlify the control of stepper motor 28byj48 you can download it from here:


How to install:

  1. cd /usr/src
  2. wget <a href="https://www.dropbox.com/s/sd86oymhcrkp4j4/lib28byj48-0.1.tar.gz?dl=0">https://www.dropbox.com/s/sd86oymhcrkp4j4/lib28byj48-0.1.tar.gz?dl=0</a>
  3. tar xvfz lib28byj48-0.1.tar.gz
  4. cd lib28byj48-0.1
  5. make
Copy the Code

Example main.c :

  1. #include <lib28byj48.h>
  2. #include <wiringPi.h>
  3. #include <stdio.h>

  4. int main(void)
  5. {
  6. if (wiringPiSetup() == -1) /* it is already call from library an is possible that is unecessary*/
  7.     {
  8.         printf("Error: wiringPi setup failed.\n");
  9.         return 1;
  10.     } else {
  11.         /* change the arguments with your pins definition and data*/
  12.         initialize28BYJ48(short waitBeforeStart, short pin28BYJ48_blue, short pin28BYJ48_pink, short pin28BYJ48_yellow, short pin28BYJ48_orange);
  13.         move28BYJ48(short linearMovement, short direction); /* linearMovement 0 to 4095 (full circle) - direction is boolean 0 or 1*/
  14.     }
  15. return 0;
  16. }
Copy the Code

for compiling:
gcc -Wall -lwiringPi -lpthread -l28byj48 main.c

The motor Vcc would be connected with 2°pin and Motor Gnd to 25°pin the the 4 signal in GPIO pin (example pysichal pin 11-12-13-14 are enumerate in code 0,1,2,3)

Any correction or suggestion are welcome.

Edit: corrected the code for full work, add a little explain of connection and makefile now do also ldconfig programmaticaly.
Ok thank you!

The article you have shared here very awesome.
Potty Racers

Done. Downloaded successfully!
happy wheels

I loved the way you discuss the topic great work thanks for the share Your informative post.
run 3

I love to read your article and get so much information through your blog and learn new things about blogging.  

I was searching for a domain for a long time and thanks for your appreciable efforts.
Delhi Escorts

Sometimes it is a good thing to read about this useful topic and you did a great job.
Delhi Escort

All of the info you have shared with us is unique for my upcoming project and I was hoping for this for a long time.
Escorts in Delhi

You have to log in before you can reply Login | Sign Up

Points Rules