I have a problem in my project

I would use push buttons to control the channel relay. The channel relay had been connected to esp 8266-01 by using blynk app. For the push buttons need to connect to nodemcu. But I have a difficulty about the coding. Anyone can help me? About the blynk app, I have to open a new project in that related project or I open a new project? Urgent

It sounds like you want to have a physical push button that can be use to toggle the state of your relay, as well as a Blynk widget switch that can be use to activate/deactivate your relay. I assume that you want the Blynk app to be updated when the physical button is used?

If that’s the case then there is a sketch available in the sketch Builder examples:

Your problem is that the ESP-01 has a limited number of GPIOs. The example is written for a full-sized ESP8266 board, so uses a physical LED. The ESP-01 doesn’t have enough GPIO pins to do this (unless you sacrifice the serial communications, which I wouldn’t recommend).

Be careful when using GPIO0, as connecting it to a relay or switch that pulls it LOW at boot will prevent the board from booting. It depends if your relay is active HIGH or active LOW as to which pin is best to use for the relay.
More info on ESP8266 pins here:

Pete.

Nevermind. I just need two switch but I still can’t do it.

Maybe if you described your issue in more detail then we’d be able to tell you how to solve the problem.

Pete.

Let me have a try first

Sir…do u mind we chat privately?

It’s better to use the forum, as other people can contribute ideas as well.

Pete.

Sir. I don’t understand this part.

// Set your LED and physical button pins here
const int ledPin = 7;
const int btnPin = 8;

It mean the switches are connected with D7 and D8?

No, it means that you would connect a physical switch to GPIO8 and an LED to GPIO7.

As I said, the code is written for a full-sized ESP8266 or NodeMCU type device, but your ESP-01 doens’t have these pins available. You only have GPIO0 and GPIO2 so you’d need to amend the code and forget about having an LED.

Pete.

I have extra NodeMCU type device. That’s mean only use one wifi module to complete the whole project,right?
Steven.

Yes, forget the ESP-01 and use your NodeMCU.

Ensure that you know how to translate GPIO numbers into “D” numbers printed on the NodeMCU board…

Pete.

If I plan to do a two circuit, one is esp 8266 with channel relay and another one is nodemcu with oled display. It likely a smartwatch. Is it possible? If possible, can I have any coding or example. Thank you so much.

It might be possible, but your description is so vague that it’s difficult to tell.
Either way, it would require a lot of work and experimentation by you, and probably better coding skills than you have at present.

Is this a school/college/university project by any chance?

Pete.

yes.It is a project from university. Do you mind help me have a look. I have done a lot of research and found one example and have to cancel out the weather because yahoo is not allowed anyone.
Here it is

smartwatch

Anymore

I try to erase the part that related to the weather but I failed to get the output what I want. The switch can’t control the circuits. Hope you can help me have a look. Thank you

So you want to get a university diploma by copying someone else’s work and getting other people to modify his code?

Pete.

1 Like

No… It just a assignment…It is also a good method to study. In Chinese have a sentence, it mean that learn other people’s forte and know my blind side. I just a beginner, just 19 years old. I feel sorry that make you so angry. I really did a lot of hardwork on it and met a lot of hardship by myself.

In general, I learned the other way - by personal experimentation and trying to figure stuff out for myself.
Of course, the Internet didn’t exist then and the things I was trying to figure-out were simpler to a certain extent, but it’s still my preferred way to learn.

The other thing is that when you ask for help, if you ask the wrong questions, and don’t provide sufficient background information, you get the wrong answers and waste people’s time.

Do you think the conversation would have gone differently if your opening gambit was…

“I’ve found this cool project and I want to reproduce it. However, I have to disable the Yahoo Weather functionality, but when I go that it doesn’t work.
Here’s the original code, and he’s what I’ve done to try to remove the Yahoo stuff - what am I doing wrong?..”

I think that by now you’d have some working code. Don’t you?

Pete.

Yes. You sound like more politely and provide a right way to understand. That still a long way for me to learn, like speaking or how to be a great person and other. Sorry and thank you for everything.

“I’ve found this cool project and I want to reproduce it. However, I have to disable the Yahoo Weather functionality, but when I go that it doesn’t work.
Here’s the original code, and he’s what I’ve done to try to remove the Yahoo stuff - what am I doing wrong?..”smartwatch