Archived source flow
Technical notes
Interrupt input
Channel A is configured for a CHANGE interrupt. The handler samples both A and B inputs.
Transition lookup
The previous and current two-bit states index a 16-entry lookup table. Its value is added to the count and stored as the latest direction value, then the current A/B state is retained for the next interrupt.
Diagnostics and limits
The loop prints the count and direction, then waits one second. Only channel A triggers the handler; count accuracy and hardware operation have not been verified. The source contains no BLE interface or motor-output commands.