Help Controlling Particle board for LED strip

Hi Everyone,

I’m new to blynk, getting things setup and struggling to understand how virtual pins control to my physical board. I’m using Particle Argon and Particle Boron boards.

I want to send my color values out to my strips on my boards D2 pin. I see my boards in the Blynk app, added the ZeRGBa, and am not sure what to do next…

For setup with Blynk datastreams, do I want 3 virtual pins (integers) with values 0-255 for RGB? If so, how do I map that relate to my Particle boards? Or do I want to use 3 analog pins as datastreams in Blynk? Where would I specify what physical pin this is on my board? Do I need to include any LED libraries like the Neopixel one?

Thank you for the help!!

Hey there,
I think you should read this first

Then you can search the forum, there’s a lots of examples how to control led strip
https://community.blynk.cc/search?q=Led%20strip

Thank you for the reply John…

I’ve checked out the documentation re: virtual pins and understand the concept… I’ve looked at different code examples, but the part that is alluding me is where/how we say what the virtual pin corresponds to on the GPIO…

In that article you sent, it says:

" Pin numbering - If you’re working with an Arduino then it’s all quite simple…
However, if you’re using a NodeMCU… the numbers screen printed onto the board are not the GPIO numbers. You have to translate these NodeMCU “D” numbers onto actual GPIO’s as follows…

Lablel GPIO
D1 5
D2 4
`…

So for my board, I assume I have to include a file / snipped somewhere that says V2 ='s GPIO 1 (for ex)?

I think you need to re-read my tutorial on virtual pins.

When a virtual pin value changes (say from off to on) then the corresponding BLYNK_WRITE(vPin) callback is triggered.
What you do then is entirely up to you. You can choose to write values to one or more physical ouns, or do any number of other things.

If you choose NodeMCU as your board type in the IDE then you can use either “D” references or GPIO numbers. Personally, I’d recommend sticking to GPIO numbers throughout - with a comment next to each GPIO number about what the corresponding “D” number is to help when wiring-up the hardware.

Pete.

1 Like

Thanks Pete… The part I’m confused about specifically is when you said:

“What you do then is entirely up to you. You can choose to write values to one or more physical ouns, or do any number of other things.”

How do I do that? can you give an example of having a virtual pin write to a physical pin?

Here is an example taken from the Sync Physical Button Example on the Sketch Builder

BLYNK_WRITE(V2) {
  ledState = param.asInt();
  digitalWrite(ledPin, ledState);
}

void checkPhysicalButton()
{
  if (digitalRead(btnPin) == LOW) {
    // btnState is used to avoid sequential toggles
    if (btnState != LOW) {

      // Toggle LED state
      ledState = !ledState;
      digitalWrite(ledPin, ledState);

      // Update Button Widget
      Blynk.virtualWrite(V2, ledState);
    }
    btnState = LOW;
  } else {
    btnState = HIGH;
  }
}

That’s helpful! ok I’m seeing how this works more…

const int ledPin = 7;
const int btnPin = 8;
… digitalWrite(ledPin, ledState);

I’m new to codewriting so am just learning what needs to be included.

It’s all in my tutorial…

The digitalWrite commands are how you turn the digital pin on or off. You need to read the comments in the code to understand what each part of the example does.

Pete.