Not the same number of virtual pins

I have a project that includes several devices and I noticed that the number of virtual pins available varies depending on the device model. Why this difference? An example ? Arduino UNO has 31 while an Arduino MEGA has 127 as well as a WEMOS D1. In the case of the UNO, can they be increased in any way?

… because e.g. the Arduino UNO has 2k bytes SRAM while an Arduino MEGA has 8k SRAM.
And the more virtual pins are made available the more SRAM will be used.

You can overwrite this limitation with

define BLYNK_USE_128_VPINS
1 Like

OK, thank you. the line of code that you indicated where it should be placed, in the setup? It is possible to indicate only a dozen virtual pins in more then
define BLYNK_USE_41_VPINS

The define BLYNK_USE_128_VPINS should be placed in the code before you include the Blynk related .h files, e.g.:

...
#define BLYNK_DEBUG
#define BLYNK_PRINT Serial
#define BLYNK_USE_128_VPINS

#include <SPI.h>
#include <Ethernet.h>
#include <BlynkSimpleEthernet.h>
...

You can add …

#define BLYNK_USE_41_VPINS

… to you code. But it will not have any effect, because it’s not known and therefore not used in the Blynk libraries.

To have more then 31 but less then 128 VPINS you’d need to modify some of the library files:



I’d prefer not to do that because changes are overwrite with each update of the libraries.

1 Like

Ok, perfect !!
Thank you.