Read from multiple virtual pins?

How would you read from multiple virtual pins?

Again, welcome… but please take note of time/date stamps before replying to posts… we try to keep posts current and avoid ‘reopening’ and any older than a few months.

Thanks.


As for your question,

Can you clarify what you are attempting and why it might be necessary to ‘read’ from multiple vPins at one time, and from where?.. the App or the MCU (sketch), etc.

1 Like

Oh, sorry I didn’t know that was a closed question.
Here’s my code:

#define BLYNK_PRINT Serial
#include <blynk.h>

const int greenLeds = 6;

BLYNK_WRITE(V0)
{
  int pinValue = param.asInt(); // assigning incoming value from pin V1 to a variable

  // process received value
}

void setup()
{
  Serial.begin(9600);

  delay(5000); 
  Blynk.begin(auth);
}

void loop()
{
  Blynk.run();
  //int button1Read = pinValue;
  if (pinValue == HIGH) {
      digitalWrite(greenLeds, HIGH);
  }
}

I’m trying to make IoT Christmas Ornaments using a Particle Photon and I’d like to be able to have multiple buttons in the Blynk app make the ornaments do different things.

Like what I have in the code above: when a button in the app is pressed (activating virtual pin 0) turn an LED (attached to pin 6) on.
For some reason, I keep getting an error from the online Particle IDE saying pinValue was not declared in this scope.

Thanks!!

Nevermind, this actually answered all my questions!!

Thank you very much for your time!!

It wasn’t closed at the time, but was very old… hence the recommendation to check the time/date stamp before posting.

I had since closed that topic and moved your question into this new topic… but looks like you found your answer anyhow, so I will mark this as solved :slight_smile:

1 Like