speed signal converting

hi everyone i need to make speed signal converter i will write down my idea

i will using arduino nano

i would have pin 5 as input which will be counting speed from hall sensor which output is 0 and 5 v.
and pin 6 would be output .

i need to change output speed lower than input example when input counts 10 000 pulses then output will give 1 pulse.

i am newbie here so programming is not good side can please someone help me out with that thanks :slight_smile:

Do you know how to read the sensor output ?
Do you know how to add 1 to a variable each time the sensor detects a magnet ?

no sorry i am nut sure how to make code for that

If you can use pin 2 or 3 for the speed sensor input you can use a simple pin-change interrupt to divide your speed input. This compiles but is not tested:

//on the Nano, only pins 2 or 3 allow pin change interrupts
const byte pinInput = 2;
const byte pinOutput = 6;

const unsigned long PRESCALE = 10000ul;

void setup() 
{
    pinMode( pinInput, INPUT );     //use INPUT_PULLUP if Hall output is open-collector
    pinMode( pinOutput, OUTPUT );
    digitalWrite( pinOutput, LOW );

    attachInterrupt( digitalPinToInterrupt(pinInput), ISR_HallInterrupt, RISING );
    
}//setup

void loop() 
{
    //this is interrupt-driven so no prescale-specific code is needed in loop
    
}//loop

void ISR_HallInterrupt( void )
{
    //static variables keep track of the prescaler count and output pin state
    //and "remembers" them when ISR function exits
    static bool
        bpinState = false;
    static unsigned long
        prescaleCount = 0;

    //on each rising edge, tick the prescale counter
    if( ++prescaleCount == PRESCALE )
    {
        //when the prescale value is reached, zero the counter...
        prescaleCount = 0;
        //and toggle the output pin
        //the '^' operator is XOR; look it up if necessary
        bpinState ^= true;
        digitalWrite( pinOutput, bpinState );
        
    }//if

}//ISR_HallInterrupt

thanks you i will test it out in few days and i will let u know results