Skip to content

Instantly share code, notes, and snippets.

@giljr
Last active August 5, 2019 20:10
Show Gist options
  • Save giljr/df3628c49a98254caf56f6e7683b0be7 to your computer and use it in GitHub Desktop.
Save giljr/df3628c49a98254caf56f6e7683b0be7 to your computer and use it in GitHub Desktop.
RPM Configurations & Industrial Conveyor Belt — ArduSerie#68 https://medium.com/jungletronics/28byj-48-stepper-motor-peak-rpm-658eae6afe2f
/*
Code 1
Board: ULN2003 Driver & 28BYJ-48 Stepper Motor & Arduino Uno IDE 1.8.5
Connections: See Fritzing in https://medium.com/jungletronics/28byj-48-stepper-motor-peak-rpm-658eae6afe2f
Power Supply: 12v .5A or 5v .5A USB Power Cable right into 5.5mm Jack of UL2003 Board
Max RPM: Power Supply 5v .5A USB -> #define waiting_time 2 (seconds) MAX 14.5 RPM
Power Supply 9v .5A -> #define waiting_time 1 (seconds) MAX 29.0 RPM
but heat issue happens:/
*/
#define stepper PORTB
#define waiting_time 1 // or 2 change here!
void setup() {
for (int z = 8; z < 12; z++) { // FULL STEP DRIVE
pinMode(z, OUTPUT); // pins 8,9,10,11 output for driving the motor
}
}
void loop() {
stepper = 0B0011; // 0x03;
delay(waiting_time);
stepper = 0B0110; // 0x06;
delay(waiting_time);
stepper = 0B1100; // 0x0C;
delay(waiting_time);
stepper = 0B1001; // 0x09;
delay(waiting_time);
}
@kbickham
Copy link

kbickham commented Aug 4, 2019

This isn't working for me, are you sure this is all the code needed for port manipulation? EDIT, I apologize... I'm wrong. I'm looking at the port map/pinout for the MEGA. For the love of god, there isn't ONE PORT that corresponds to 4 pins for a single nibble of bitspace.

@giljr
Copy link
Author

giljr commented Aug 5, 2019

Thank you for your visit. It is really hard to believe how simple Port Manipulation Code is... Right now I'm working with a stepper motor slider two phases like this one for my Mini Prusinha Printer running this very code; just a coincidence:) and I will publish it very soon in jungletronics...Anyway, in this post too, I make more PMC! bye o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment