Hello. I have a problem with de function BLYNK_WRITE(). I have made a project with DHT22 and It works very well. I can send both data temperature and humidity to my i-phone in Blynk. But I want to make another project to send data from the app of Blynk to the board. I am using to my new project the NodeMCU ESP8266 v1.0 V3 that I bought in AZ_Delivery. I have made a eassy project with a button. The target of the project is to turn on a led activiting a button in app blynk. I’ve realized that the function BLYNK_WRITE never is ejecuted because there is not any message in the monitor serie. In the software IDE I have chosen the NodeMCU 1.0 and in Blynk NodeMCU WIFI. When I run the program I can not change the led in the board.
I have read the other topic in this forum but the problem continued. My pricipal question is why the function BLYNK_WRITE() is not called. All my libreries are updated. The sketch is:
#define BLYNK_PRINT Serial
SoftwareSerial DebugSerial (2,3);
// You should get Auth Token in the Blynk App.
// Go to the Project Settings (nut icon).
char auth = "vJsc8Mi-pIgy3_SrMzoFqFZaVpSYM0c";
// Your WiFi credentials.
char ssid = "MOVISTAR_94B2";
char pass = "UFrqD3p4KTSeQ5BFyj8";
int a = param.asInt();
// Debug console
pinMode (5, OUTPUT);
Blynk.begin(auth, ssid, pass, "blynk-cloud.com",80);
Thanks in advance.
The auth code you have posted here is invalid, which may be intentional. However, it does prevent me from seeing what widgets you have connected to pin V2.
Could you clarify this please?
Also, could you clarify if you have two hardware devices (the one that has the DHT22 attached to it) and the NodeMCU in the same project, or are these in different projects?
Are you using different auth codes in your two sets of code for the different devices?
Thanks for your response.
I eliminated a vowel of the auth for safety. The hardware is connected to Blynk perfectly. I have used a botton in app blynk with a virtual pin V2 whith switch 0 and 1.
They are different projects. I want to mean that with DHT22 there is no problem because I use Blynk.virtualWrite () to put the values in the i-phone,
Neither the board works if I choose the digital pin in the blynk.
Right now, I was working in a proyect with a servo with arduino uno and this works fine. I have used the blink but with USB with my laptop.
In my board I have only a device, a led, and I want to turn on/off with a virtual pin V2.
I have detected that the funtion BLYNK_WRITE() is not called never, so “Serial.println (a)” from my sketch doesn’t appear on monitor serial.
Thanks in advance.
Are you seeing any output in the serial monitor when the device boots and Blynk connects?
If not then your serial monitor may be set to the wrong baud rate.
Which pin on the NodeMCU is your LED connected to (what text is printed next to the pin on the board)?
BTW, you should remove these two lines:
My monitor serial is baud rate 9600. When the board is connected I can see:
I have connected a led in the digital pin D1 (GPI05) and the blynk is selected the virtual pin V2, as my sketch. You can see that in BLYNK_WRITE(V2) is put Serial.println (a) and in the serial monitor I never see it.
Thanks in advance.
Okay, there is nothing wrong with your code - I’ve just uploaded it to a NodeMCU and it produced 1’s and 0’s in the serial monitor and turns the LEDE on and off.
You problem must lie with either the auth code that you are using or the way that you’ve set-up your switch widget in your app.
I’m guessing, from what you said originally, that you are using the auth code for your temperature monitor project in the code that you’ve uploaded to your NodeMCU, rather than the auth code for your new project.
If that’s not the case then either you haven’t used pin V2 in your app, or you have multiple devices in your app and that you’ve connected the wrong device to your switch widget.
The NodeMCU ESP8266 V3 can’t be updated in IDE, I have to use a version lower. I think that the software Arduino needs to adapt to the last version of this board. If you use a version of the board ESP8266 lower all is fine.
Thank for all.
I don’t think that’s true. You may need to press the Reset and Flash buttons first, but the IDE, with the appropriate (preferably latest) ESP core, is capable of uploading code to a working NodeMCU v3.