SX28 Microcontroller - Bycicle counter with Hall-sensor

I wanted to make a counter for my bike with a TLE4905 Hall-sensor. First, I wrote a program which turned on a led, when I toke a magnet to the sensor (it worked good), but when I wrote a new program with a counter that didn't work. I still want to write a counter because I want to count the rev (I don't know, what's the good word for this) of my bike. If you can help me with the program, please write!

Comments

  • 4 Comments sorted by Date Added Votes
  • If you post your code some of us can probably help you.

    Bean
  • Sorry, here's the code.
  • So what is happening with this code ? Does the LED never come on ?

    You should set counter to zero before the loop.

    You need to wait for the sensor to be off. As it is now the counter will increase every time through the loop as long as the sensor is on.
    I would make a variable to hold the last sensor state, then you can say if the last state was off, and the current state is on, then increase the counter.

    Bean

  • Ok. Thanks. My problem is the led is on always. I try to zero the counter.
Sign In or Register to comment.