Bug 1 of 3 · inspired by my IoT Inventory Tracker
“The scanner has déjà vu.”
You tap one water bottle on the reader. The reader notices it 3 times in a row, and now the shelf has 3 water bottles.
scanner.pseudothe buggy code
when the reader sees a tag: add the tag to the shelf// the reader often sees the same tag// a few times in a row
when the reader sees a tag: if this tag was added in the last 2 seconds: skip it add the tag to the shelf
About this demo
What was the bug?
The code added every detection to the shelf. But a reader can see one tag several times while you hold it there. The fix remembers when each tag was last added and skips repeats that come in too soon.
Honest label: a simplified demonstration inspired by my IoT Inventory Tracker. It isn’t a real bug from that project.
Read about the IoT Inventory Tracker · Its source on GitHub (opens in a new tab)