(SOLVED) Voltage difference between digital pin HIGH and virtual pin HIGH

Hi, I’ve figured out how to use virtual pins but have run into some odd behavior I cannot explain.

Hardware: Arduino Yun switching a 5v relay board on digital pin 10.

When I set up a button widget using digital pin 10, the switch actuates my relay no problem.

However, when I first set up the widget using a virtual pin and the code below, the voltage output by the physical pin 10 is very low, too low to actuate the relay coil, but enough to light an led dimly (~2v).

This is probably a hardware quirk, because when I first set the button to use digital pin 10, it works as expected. If I then switch the widget to use virtual pin 10, it starts working. Once I flash new code to the Yun, it goes back to the low voltage output on virtual pin 10.

Does anyone have insights on this quirk?



     digitalWrite(10, HIGH);
     digitalWrite(10, LOW);

void setup()
  // Debug cons


void loop()

It’s not hard to read since it’s so little but please always format your code by writing this:

CODE here

Edit. You beat me to it lol or someone did it for you :stuck_out_tongue:

1 Like

Out of curiosity did you set your button widget to switch mode?

I RTFM’d! Thanks!


Yes, It was set to switch mode.


Try setting your pin mode as output. It sounds like it’s floating.


In setup add
pinMode(10, OUTPUT);

Yep, it was as simple as that.

Much obliged.


1 Like

For the benefit of the community, I found this very concise 10 minute video that explains the phenomenon of floating pins.

Floating Pins with Arduino