240/(bpm*4)
When bpm is 60, this evaluates to 1. When bpm is greater than 60, this evaluates to 0.
You are assuming that all arithmetic is performed using floating point arithmetic. It is not. If you want to force floating point arithmetic, you must use floats, like 240.0 or 4.0. Or make bpm a float.