Arduino and BV20 Bill Acceptor/Validator

The first is that the pulseIn() function works with microseconds

and returns an unsigned long, which you are trying (unsuccessfully) to shoehorn into an int.