arduino-based impulse sequence detection