Arduino and BV20 Bill Acceptor/Validator

ea123, thanks for the reply. Did the wiring you recommended and copied the code in Arduino. After I inserted a $5 bill that's what I got in Serial Monitor:

-2726
12526
20487
31807
-21701
-7533
5954
18410
31594
-20286
-7357
5292
16138

One line every 3 seconds.

What went wrong?

Rockwallaby: thanks for the reply too. That's what I did after your advice:

int pulseCount = 0;

void setup() {
    Serial.begin(115200);
    pinMode(2, INPUT);   
}

void loop() {
    int x = pulseIn(2,LOW);
    
        if (x >= 500) {
            pulseCount = pulseCount + x;                
        }
        
    if (millis() % 3000 == 0) {
        Serial.println(pulseCount);
    }     
}

but i'm still getting inconsistent readings out on Serial Monitor. Can't tell the difference between the pulses sent by the bills. Two things surprises me. The first is that the pulseIn() function works with microseconds, not miliseconds, so a 50ms pulse should be recognized just when pulseIn >= 50000, but in my case it just recognizes pulses between 500 and 1200 only. The second thing is that the serial monitor outputs the pulses even BEFORE the device finished sending it to them (i mean, the device is still busy sending the info but the serial monitor already showed its full range of pulses). I'm probably not getting the pulses right.