I am wondering if anyone can help me with an issue regarding conflict between the A4988 stepper library and a small OLED display.
I have a project designed to run two stepper motors from a NANO using A4988 stepper drive boards. The logic is driven by a small control box containing pushbuttons and a 0.96" OLED display (SSD1306).
I can run the OLED display with no problems and the logic will respond to button pushes. I can drive the stepper motors OK from the logic via the A4988 library. The problem arises when I try to do both things in the same sketch.
Once I define an A4988 stepper motor object using the line
A4988 stepper(MOTOR_STEPS, DIR, STEP, SLEEP, MS1, MS2, MS3);
this causes the OLED display statement to hang and the program just stops.
The OLEDdisplay uses the standard address 0x3C. Does this conflict with anything in the A4988 library?
As a matter if interest I started developing this with project with the Accelstepper library and encountered the same problem.
I am mystified. Any help would be appreciated.
I attach the code in its current state. All stepper commands were commeted out then enabled one at a time. Once the A4988 stepper object was uncommented and recompiled, the problem occurs.
Sorry for the delay, but here is the information you requested.
Attached is a layout of the components in the project - A4988 and OLED Stepper Driver.pdf. I have also attached two sketches:
A4988_OLED_no_Stepper.ino - in this the stepper code is comment out. If this is uploaded the OLED and buttons work correctly.
A4988_Stepper_no_OLED.ino - in this the OLED function is commented out. If this is uploaded the buttons work OK and the stepper runs as required (output via the serial monitor as no OLED).
If the 1st sketch is used and the stepper code is gradually uncommented, all works until the stepper object is defined - A4988 stepper(MOTOR_STEPS, DIR, STEP, SLEEP, MS1, MS2, MS3);.
The libraries are :
I note that the Adafruit-GFX library has a later version available - 1.5.7 in place of the 1.5.6 I have installed. I will update that and see if that makes any difference.
Any ideas of what could be causing this issue would be appreciated.
Yes - I do have a capacitor across the 12v supply close to the regulator. Sorry I missed it on the diagram. It’s a 33 Microfarad 50 volt, the closest I had to the 47 Microfarad recommended.