my code wont display RPM

this code is for a dc motor which has a 32 bit rotary encoder with a infra red sensor circuit which will feed back to the LCD and display the rpm my issue is that the RPM displayed on the LCD is stuck at zero.

#include <LiquidCrystal.h>
#include <SimpleTimer.h>

int i;

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;

// the timer object
SimpleTimer timer;

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// a function to be executed periodically
int repeatMe() {
static float RPMvar = (i/32)*60;
static char RPMchar[15];
dtostrf(RPMvar,6, 3, RPMchar);

lcd.setCursor(0, 0);
lcd.print("RPM: ");
lcd.setCursor(4, 0);
lcd.print(RPMchar);

return i = 0;
}

void setup() {

pinMode(ledPin, OUTPUT);
pinMode(interruptPin, INPUT);

// set up the LCD’s number of columns and rows:
lcd.begin(16, 2);

timer.setInterval(1000, repeatMe);

// configure the interrupt call-back: blink is called everytime the pin
// goes from low to high.
attachInterrupt(digitalPinToInterrupt(interruptPin), blink, RISING);
}

void loop() {
digitalWrite(ledPin, state);
timer.run();
}

int blink() {
state = !state;
i++;
repeatMe();
return i;
}

An interrupt service routine that returns a value? Where to?

Please remember to use code tags when posting code

    return i = 0;oops2

the interger "i" is to hold the value of how many times the LED (pin 13) flashes, i have fixed the return i issue does this look better?

int repeatMe() {
    static float RPMvar = (i/32)*60;
    static char RPMchar[6];
    dtostrf(RPMvar,6, 3, RPMchar);
    
    lcd.setCursor(0, 0);
    lcd.print("RPM: ");
    lcd.setCursor(4, 0);
    lcd.print(RPMchar);  

    i = 0;
    
    return i;
}

however the code is still not displaying RPM how would you recommend me fixing this?

Post your code.

#include <LiquidCrystal.h>
#include <SimpleTimer.h>

int i;

const byte ledPin = 13;
const byte interruptPin = 2;
volatile byte state = LOW;

// the timer object
SimpleTimer timer;

const int rs = 12, en = 11, d4 = 5, d5 = 4, d6 = 3, d7 = 7;
LiquidCrystal lcd(rs, en, d4, d5, d6, d7);

// a function to be executed periodically
int repeatMe() {
    static float RPMvar = (i/32)*60;
    static char RPMchar[6];
    dtostrf(RPMvar,6, 3, RPMchar);
    
    lcd.setCursor(0, 0);
    lcd.print("RPM: ");
    lcd.setCursor(4, 0);
    lcd.print(RPMchar);  

    i = 0;
    
    return i;
}

void setup() {
  
  pinMode(ledPin, OUTPUT);
  pinMode(interruptPin, INPUT);

  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);

  timer.setInterval(1000, repeatMe);

  // configure the interrupt call-back: blink is called everytime the pin
  // goes from low to high.
  attachInterrupt(digitalPinToInterrupt(interruptPin), blink, RISING);
}

void loop() {
  digitalWrite(ledPin, state);
  timer.run(); 
}

int blink(int i) {
  state = !state;
  i++;
  repeatMe();
  return i;
}
int blink(int i) {
  state = !state;
  i++;
  repeatMe();
  return i;
}

Please see reply #1.

You’re calling repeatMe from two places.
Why?

i will get rid of that second call is this why it is not counting?