BLYNK
HOME       📲 GETTING STARTED       📗 DOCS       ❓HELP CENTER       👉 SKETCH BUILDER

Same pin in both hardware

Dear All Have a nice day

I have two hardware ( two NODE MCU’s)

I used same pins of both Node MCU to turn on and off LED’s (Ex. D1, D2,D3)

But One Node MCU is controlling by switch module in Blynk APP
and other node MCU is controlling by Segment switch in Blynk App

Segment switch assign with virtual pins ( V1)
Program is working but both hardware is working simultaneously even I pressed any switch

Please advice

    BLYNK_WRITE(V1) { // Widget for interval timing
  switch (param.asInt())
  {
    case 1: { // Item 1
        digitalWrite(D1, HIGH);
        digitalWrite(D2, LOW);
        digitalWrite(D3, LOW);
        break;
      }
    case 2: { // Item 2
        digitalWrite(D1, LOW);
        digitalWrite(D2, HIGH);
        digitalWrite(D3, LOW);
        break;
      }
}
}

void loop() {
 
  Blynk.run();
  BLYNK_WRITE();

}

@dayan please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.
Triple backticks look like this:
```

Pete.

Thanks … Done

No, I gave you triple backticks to copy/paste and you chose to use different characters instead.

Also, you need just one set of triple backticks at the beginning and one set at the end of your code, not multiple ones throughout the code.

Pete.

Done

Why do you have this in your void loop? What do you think this achieves?

How are your two devices configured in the app? - as two separate NodeMCUs with their own Auth codes hopefully?

Are you putting those two Auth codes into the two different sketches for your NodeMCUs?

Pete.

1 Like
BLYNK_WRITE();

I thought this function to be called in the loop, Just I know that function is called automatically , But my problem is existing

Single Auth code is using for both hardware

Four buttons used to control one hardware
Segment switch is used to control another hardware

New situation
Wend I pressed Segment switch then LED’s on and off correctly with correct hardware , No any effect to another hardware

But
When I pressed button switch then LED’s on and off on both hardware , That is the issue

Please advice

That’s your problem.

Pete.

Can we have the two Auth Code for single project

Dear Pete

Thank you so much for help

Problem is solved
Thank once again