Big chance you missed a number of bits &| bytes. pulsein() waits for low, times a pulse. If in the time you are processing the pulses there is another pulse you will miss it.
Better connect the reader to the interrupt pin, fill an array with values and parse these.
This is my code :
int pin = 7;
unsigned long duration;
void setup() {
Serial.begin(9600);
pinMode(pin, INPUT);
}
void loop() {
duration = pulseIn(pin, HIGH);
Serial.println(duration);
delay(5);
}
Can you give me an example using interrupts?
Thank you both for replyes!