Hi Oliver!
I bet I'll meet you in the middle.? I actually did notice that we're not clearing wiegandBits in the timeout case after I posted, and had a small tweak in mind (just set it to zero in the timeout case).? That said, everyone in this forum has another willing resource -- a human being, namely myself (and others with your expertise as well), willing to review the code and perfect it -- assuming that was even necessary.? In this case, both things you mentioned would not have detracted from the device's ability to correctly translate a Wiegand keypress over 99.99% of the time,?with these edge cases resulting in garbage data in the event of actual on-Wiegand-wire line noise... something we would already get on the on-serial-wire line noise and can't do anything about (a shortcoming of serial comms)... and something a SIMPL serial in block would completely ignore.
So yes, if anyone uses this, it'll probably be on me to make sure this works correctly -- but otherwise, the brave soul will be out the <$100 they invested in my suggested experiment and it didn't rise to meeting their needs.
In my experience, the vast majority of these Wiegand keypads all pump out 4 bits per keypress, or can be configured to.? Both the Amazon ones and the professional security ones.
I think the point I'm trying to make is that ChatGPT enables us to punch well above our weight and parlay our existing programming experience into new worlds we never thought possible.? When you're an A/V installer who has a client asking about "can you integrate this keypad with Crestron" and the answer goes from "maybe" to "yes" to "definitely" (when people with actual experience weigh in with the solution), you've professionally solved a problem you weren't expecting from the client to ask you to fix.
I'll be as bold to say that WHEN someone gets this solution working, and reports that it is robust (you can ignore me for now -- I've got Arduino Wiegand keypad solutions working with over 99.999% uptime and reliability, but take it from the first guy who tries this idea I posted), you'll all have discovered that you can buy these Wiegand keypads on Amazon for $25... and they are outdoor rated and rain tolerant... and you can integrate them with Crestron to solve dozens of use cases needing a wall-mount numeric keypad... we are all better off!? And for those not wanting the sight of a $25 Wiegand keypad on their job, you can buy a $400 one from HID that's the exact same part used at your local airport and other highrise buildings instead of imported stuff for high security installs, and it will work with this Arduino exactly the same.? Wire it the same.
I silently cringe when we discuss the recent issues with CP4's failing, or database updates that magically break the basic functionality of the D3 scheduler for months, and then just tolerate this like it's so unfortunate there's no way around it, but then worry about how unprofessional Arduinos are.? In context, I'm just saying if you've got a solution that meets the client's needs, and it does so reliably, at a decent cost using materials with a strong supply chain, and boots 1000 times as fast and never needs software updates, what exactly are the criteria for the solution being "professional" again???
Mike
On Thu, Feb 27, 2025 at 2:58?AM Oliver Hall via <oliver.hall=
[email protected]> wrote:
Apologies for taking this off-topic, but this is an example of why it troubles me in the way that ChatGPT (and the like) may be used in a professional context - and (from our perspective) Crestron development/installation is explicitly not a consumer/DIY product.? While I'm sure this code "works", if people were to take the generated code and blindly run with it, it glosses over any sort of error checking and could be quite fragile.
?
As a trivial example - what happens to the wiegandData already captured in the 100ms timeout case?
Nothing - the next nibble that comes in will have the 4 new bits shifted on with the _existing data_ shifted up.? The result will almost certainly be > 9 and then you add the ASCII 'A' offset - so you'll get some weird data there - not even ASCII Hex.? The Wiegand protocol has a 50ms timeout (not 100ms) and packets are variable bit length - not always neat 4-bit boundaries - so there is room for trouble here.
?
It's also poor (IMO) code.? A "human" programmer would be more likely to use a built in function such as Serial.print(wiegandData & 0x7, HEX); instead of manually converting to ASCII.? Cleaner code, more readable, easier to understand and maintain (possibly by someone else!)
?
I'm not advocating against using AI in programming - we use it a lot (you can hardly move without bumping into Copilot anyway these days) - but I do think we should be VERY careful about swallowing what it generates.? LLMs might get things moving in the right direction, but if you don't understand what you're being fed, it could well blow up in your face.? Too many mixed metaphors there, sorry.
?
Michael - I'm not bashing your solution here - if it works in the context (and if there's a paying customer involved, they understand they're getting something bespoke, with the support challenges that brings with it) then all good.? My gripe is that people "believe" in ChatGPT far too much.
?
All the best,
Oliver