This Arduino program is designed to interface with a two-channel incremental encoder and display the rotational speed of a roller conveyor on an LCD screen. The main functionalities of the program include:
- The program initializes a 16x2 I2C LCD to display the calculated speed.
- It sets up two digital pins as inputs with internal pull-up resistors to read signals from the encoder.
## Interrupt Handling for Encoder Pulses
- The program uses external interrupts on the encoder signal pins (CLK and DT) to accurately count pulses.
- Two interrupt service routines (ISRs) are defined: `ai0()` and `ai1()`. These routines increment the pulse counter based on the state of the encoder signals, ensuring the counter increases only in one direction to prevent negative values.
## Real-Time Calculation of RPM and Speed
- The main loop of the program calculates the RPM (revolutions per minute) and the speed in meters per minute (m/min) every second.