Shellminator V3.0.1
Simple Terminal
|
Fortunately, today, every smartphone is capable of scanning QR codes. This can be really useful when you’re out in the field and need to display an error code via a QR code, or even generate a unique link to a configuration portal for wireless devices. Luckily, we've implemented this feature for you—just provide a C string, and the QR code will be generated automatically.
The library is built on the Nayuki QR code generation codebase, which is a widely used solution in the industry. We specifically use the C implementation, as it is the most memory-efficient.
And speaking of memory efficiency, unfortunately, this feature does require a relatively large amount of memory. The recommendation is to use it on platforms with at least 16kBytes of dynamic memory. Because of this, the Arduino Uno R3, unfortunately, isn't suitable. But the good news is that platforms like the ESP32, Raspberry Pi Pico, and Arduino Uno R4 can easily handle this limitation.
First, you’ll need to include the library:
Then, create an object that handles memory management:
Finally, all you need to do is specify which channel the output should go to and what text it should contain:
You can optionally specify the level of error correction to be included in the QR code.
ECC Setting Definition | Tolerance |
---|---|
qrcodegen_Ecc_LOW | The QR Code can tolerate about 7% erroneous codewords |
qrcodegen_Ecc_MEDIUM | The QR Code can tolerate about 15% erroneous codewords |
qrcodegen_Ecc_QUARTILE | The QR Code can tolerate about 25% erroneous codewords |
qrcodegen_Ecc_HIGH | The QR Code can tolerate about 30% erroneous codewords |
By default, the medium setting is used, which allows for about 15% error tolerance. However, if you'd like to increase that to 30%, all you need to do is look up the setting name for 30% in the table, which is qrcodegen_Ecc_HIGH
, and then modify the previous code like this: