diff --git a/hidReader.ino b/hidReader.ino index 421cf27..3b6c36b 100644 --- a/hidReader.ino +++ b/hidReader.ino @@ -26,23 +26,21 @@ volatile size_t bitCount = 0; // number of bits recieved volatile unsigned long weigand_idle_start; -inline void gotBit() { +inline void gotBit(char bit) { weigand_idle_start = millis(); + Serial.print(bit, BIN); + bitWrite(dataBits, DATA_SIZE - bitCount, bit); bitCount++; } // interrupt that happens when INTO goes low (0 bit) void ISR_INT0() { - //Serial.print("0"); - dataBits &= ~(1UL << (DATA_SIZE - bitCount)); - gotBit(); + gotBit(0); } // interrupt that happens when INT1 goes low (1 bit) void ISR_INT1() { - //Serial.print("1"); - dataBits |= 1UL << (DATA_SIZE - bitCount); - gotBit(); + gotBit(1); } void setup() {