Stepper display on I2C SSD1306 OLED

Hello everyone. I have a code that works for my X/Y stepper control. I am using a joystick to control them. I would like to add a simple code that will display the x and y steps that have been taken but be able to reset it with the select button of the joystick. I am not using any limit switches or anything so X0 and Y0 can start anywhere on the stepper. I hope that makes sense. Here is the components I am using with my Uno.



and finally the code:

#include <Stepper.h>
#define STEPS 2000 // the number of steps in one revolution of your motor (28BYJ-48)
Stepper stepper(STEPS, 8, 10, 9, 11);
Stepper stepper1(2000, 2, 4, 3, 5);
int potState = 0; 
int pot1State = 0;
void setup() {
 void loop() {
  potState = analogRead(A0); //reads the values from the potentiometers
  pot1State = analogRead(A1); //
  Serial.println(pot1State); // sends joystick data to serial port for debuging

  if (potState > 600){  //all code below controls movement
  if (potState < 400){

  if (pot1State < 400){
  if (pot1State > 600){

So, what have you tried ?

I guess I should have mentioned, this is my first time using an LCD readout. I read up on the basics but I do not know what to do about getting the data from the steps taken, nor how to reset the step count.

When I said simple, I am wanting something like this:

When powered on first time:

X Axis = 0.000
Y Axis = 0.000

Then after steps are counted, and the user wants to reset it they press the select button on the joystick to reset the display (not move the steppers).

The stepper library is pretty basic and doesn't appear to keep a step count (at least looking at the reference).

You could write your own wrapper for the library's step function and have that do the counting. Alternatively, look for a more sophisticated library, maybe Accelstepper.

Each time You order stepping add/subtract the amount of steps to variable keeping the position.

If you have never used the display before then start with the examples that come with a library

Incidentally, that is not an LCD display, it is an OLED display

Hi, I have a SSD1306 test sketch downloadable off my site. This shows how an 128x32 SSD1306 is used. See the download link/