Problems with GPIO

I am not sure if I am interpreting your issue correctly…

Changing many widget parameters, including colour, from the sketch can be done via the Blynk.setProperty command But ONLY when they are using virtual Pins

image

B[quote=“etabeta, post:1, topic:32655”]
blynk does not recognize the GPIO buttons how can I fix it?
[/quote]

Your sketch doesn’t use any GPIO pins, and the button widgets in your app should be connected to virtual pins, not digital pins.
Also, you don’t have any Wi-Fi or Blynk credentials declared, but I assume you’ve removed these otherwise the sketch wouldn’t compile.

You’re treating your Arduino ESP thingy as an ESP device, when I suspect from the name that it’s actually an Arduino with an ESP that’s designed to work as a Wi-Fi modem - in which case you won’t get it working with this sketch.

Personally, I’d say that you’d be far better off using a NodeMCU or Wemos D1 Mini as your IoT hardware rather than devices like the one you’re using.

Pete.

Unfortunately I have already purchased this device.On the phone is set as “esp8266” Regarding the digital pins work because from them the physical buttons on arduino.Ed the problem lies in the fact that in the scheck of blynk I can not connect them to virtual pins because I he says they are not recognized. Where am I doing wrong?If I use virtual pins how to redirect them to GPIOs?
In the various examples always refer to the nodMCU.In the scheck the digital buttons I did not need to declare them already working like that

Are you using this as a stand-alone device, or with an Arduino?

Pete.

The device is stand alone. The GPIO outputs are connected to arduino one

Sorry, but I don’t understand what you mean by that.

Pete.

If you managed to view a photo of the device see that esp also has the GPIO outputs separated from the rest of the image

So my problem is connecting the digital pins to a virtual pin. When I try to do it, blynk tells me that GPIOs are not declared, so how can I declare them?

Exactly how have you tried “connecting the digital pins to a virtual pin” and exactly what message do you get?
Is this a message from the Blynk app, or from the Arduino IDE?

Pete.

When in the scheck I go to tell him that GP5 must be equal 0 tells me that gp5 has not been declared. I forgot to expand the program via the ide of arduino, and so it is the ide of arduino that says it is not declared

How EXACTLY are you trying to do this in your sketch?
Post the portion of code where you’re doing this, and explain where in your sketch you’re including this code.

Pete.

OK, @etabeta Something you may not be understanding. The shield you have can probably run in different modes, much like other combo MCU devices that we have seen here (AKA Robotdyn)

A) As a standalone ESP8266 using it’s own pins
B) As an Arduino with WiFi via the ESP in AT WiFi to USB (Serial) Mode.

Regardless of which mode you use, Blynk will only see it as an Arduino or an ESP8266, depending on the DIP settings and the Blynk library/setup used… But apparently not both at once.

Google around for what limited info there is on this board… then pick what mode you what to use… or better yet… Get a $5 Wemos D1 Mini.

Yes, I said it :smiley: … as a long term Arduino with ESP as shield user, I am NOT recommending these over priced combo mashups… too much effort for the gain. Even a simple Arduino/ESP-01 hookup is better.

I think that @etabeta is probably using the wrong syntax for his digital writes, and rather than just using the pin number he’s probably using a variable to represent the pin number, but of course that variable hasn’t been declared, hence the:

message.

But, it is like getting blood out of the proverbial :grinning:

Pete.

After a little further reading of that post I linked, while not clear, it looks like one can possibly load and run separate code on boath ESP8266 and UNO (via SoftSerial)… but you have to keep switching the DIP interface back and forth for programming??

Anyhow… @etabeta If that dual running MCU function does work, then in theory it could be treated as a standalone ESP running Blynk with a softwareSerial link to non-Blynk code on the Arduino… Sorta simular to this - Turning "Old" Arduinos into Perfectly Usable IoT Devices

But not really practical… and despite my attempts to do something similar, it is NOT a process you will get much assistance with from here.

Perhaps @etabeta should start by trying the “no code required” Eventor widget.

Button on V1 and onboard LED active LOW:

Hmmm… OK, I think I might understand…

While the App (set as using an ESP8266) will show the Digital GPIO pins as gp1, gp2, etc… In your code you ONLY use the number of the GPIO.

For example, using a button on V0 to control gp5

BLYNK_WRITE(V0) {
digitalWrite(5, param.asInt());  // Toggle GPIO pin 5 to the same state as the Button on V0
}

I think you understood exactly, the only difference is that in the schek I tried in every way but it’s not okay.Adess I’m trying as you advised me

Of course that command is assuming the ESP8266’s GPIO pins, NOT the Arduino ones… they are probably NOT directly accessible from that Blynk Sketch.

Nothing to do I can not I tried it but it does not even go

BLYNK_WRITE(V1) {
digitalWrite(5, param.asInt());  // Toggle GPIO pin 5 to the same state as the Button on V0
int gh=0;
gh=digitalRead(5);
if (gh==HIGH){
led3.on();

I have no idea what “it does not even go” means in practice, but I’d simplify this code like this:

BLYNK_WRITE(V1)
{
  int gh=(5, param.asInt());
  if (gh)
  {
    led3.on();
    digitalWrite(5,HIGH);
  }
  else
  {
    led3.off();
    digitalWrite(5,LOW);
  }
}

I’d also add this in void setup():

  pinMode (5,OUTPUT);

Pete.