Simple read code of clear path motor Pulses

Hello All, i have been trying for the last few hours to write some simple code to read a pulse from a clear path motor.
it outputs 8 pulses per rev.

this is the circuit:

image

i simply want to count up using the pulses.

i have attempted many sketches but cant seem to get it to work.

i am using an Arduino Nano and digital pin 2 as the input_pullup.

i would post my code but it probably completely wrong.

could someone point me in the right direction?

something like and fill in the blanks:

int counter =0;

void setup() {

Serial.begin (9600);

pinMode(2, INPUT_PULLUP);

void loop(){
Serial.println (counter);
}

please show us your efforts

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.