Hi, first at all, sorry about my “english”
I have a problem with my project Blynk (Arduino Mega, connected by USB to my local server), need to change the state of a virtual pin to write the state of a digital pin.
I have this code in arduino:
widgetRiego void ()
{
if (digitalRead (pinRiego) == LOW) {
Blynk.virtualWrite (40, “Watering”); //if pinRiego(D52) is LOW, show “Watering” msg
} Else {
Blynk.virtualWrite (40, “Off”); //if pinRiego(D52) is HIGH, show “Off” msg
}
}
In Blynk App I set a button to on / off the digital pin 52 (pinRiego), and a Value Display on pin V40 to read the state (watering or off) with 3 sec interval.
Finally, I have in void setup:
timer.setInterval(3000L, widgetRiego);
When I press the button in the app to on/off the digital pin 52, works fine the first 2 or 3 attemps and then get the following error on my local server:
InOut(): GetOverlappedResult(EVENT_WRITTEN) ERROR Too many links (31)
If I delete the widgetRiego sentence, the button to on/off D52 pin works fine.
Sorry if it’s something very basic, but I’m just starting in this world.
Thanks a for this amazing community, has helped me a lot.
Regards
Pancho
I believe by default Mega’s might have 32 V pins (0 to 31) but there is a flag you can set if you think it can handle more (like an ESP). Can’t remember what the flag is though. A thorough search of this site or the GitHub should find the flag unless @vshymanskyy can point it out to us.
Hi Costas! thanks for your quickly answer!
I have my arduino connected over USB, I didn’t know I could only use up to V31, I’ll change it to test
Thanks again, I will update with the results.
Thanks a lot for your help!
i tried changing the VPins (under V31) and uncomenting the flag that you sent me, and something changed, but I still having issues.
I don’t have anymore the “Too many links” error, but after some clicks on my swtichs buttons, seems like I lost the connection (sensors doesn’t update the values, switch buttons doesn´t change the digital pins status, etc). and the only way to solve it, is restarting my arduino.
In short, I have the same issue, but now I don’t have the “too many links” error.
If I delete the arduino code to change the VPIN status, the switch buttons works fine everytime.
Any idea?
@Pancho I have looked through your code and I can’t see anything obviously wrong with it.
I checked some Mega settings and it looks like 128 virtual pins is the default in the App so I’m not sure if you needed to make the tweak to the library that I suggested.
All I can suggest is creating a sketch with all the VPIN stuff included and none of the DHT stuff i.e. turn some app and Mega onboard LED’s on and off etc.
If that works ok then the problem is somehow related to DHT. If it doesn’t work then we need to investigate the VPIN’s in more detail.