Your new topic does not fit any of the above??? Check first. Then post here. Thanks.

Moderator: igrr

User avatar
By alex_g
#66688 I've made a little sketch which receives 433MHz signals (using rc-switch) and which publishes them to MQTT.
The sketch works fine off the Arduino IDE, but when I removed it from the computer and tried to run it as standalone, it would not play...

I reconnected to the computer and I discovered that in fact the sketch will not run if the Serial monitor is not active in the IDE!!! So I assumed that the calls to Serial are blocking (shouldn't be the case, IMHO), and I commented out all the references to serial, including Serial.begin(), so that any communication is done purely through MQTT.
It still does not work!!

Even if nothing is written to the serial terminal, the script will not run if the terminal is not open. If it is open it runs absolutely fine.

I am using the latest Arduino IDE on Linux. My ESP8266 is the "Witty" board, which I specify as NodeMCU 1.0 (ESP 12-E Module) to the IDE and has always worked fine for everything else.

What am I doing wrong?
Sorry if the answer is obvious, I'm a Lua guy, only using Arduino because Lua doesn't have the rc-switch library... Although I admit I found it fun using Arduino, especially since I can use C++ and not just C, I'm sure I'll be using it lots more... :)

First really need to sort this out, though!

Cheers!
User avatar
By rudy
#66690 You didn't say what you have connected to the board. What is driving the pins. (or not) I am assuming that GPIO0 is pulled high, GPIO2 is pulled high through the LED circuit, and that GPIO15 is low on start up. Also that CH_PD is pulled up high always.

If that is all correct then I suggest using a resistor to provide a pull up on the RX pin. When not high I have had that block my code from running.
User avatar
By alex_g
#66693 Hi Rudy,

Thanks buddy, you beat me to it!

I had been feeding the radio signal to GPIO0. Soon as I changed that, everything started working properly.

I am still a bit curious as to why - but hey - at this stage, I just want something that works.
The reason I got confused was that I had previously done a test set-up that worked just fine with GPIO0 getting the radio signal. That's how it was coded in my program, I never gave it a second thought, since it had previously worked. However that was with an ESP-07 chip. This time I was using an ESP-12. (well, two different ones, actually)

Funnily enough I had used exactly the same board to program the ESP-07 as the ESP-12s ( the Witty base). One case worked, the other didn't. One day I'll understand the exact ins and outs of the ESP8266 pins and their levels.

Until then, I am just glad it works!



rudy wrote:You didn't say what you have connected to the board. What is driving the pins. (or not) I am assuming that GPIO0 is pulled high, GPIO2 is pulled high through the LED circuit, and that GPIO15 is low on start up. Also that CH_PD is pulled up high always.

If that is all correct then I suggest using a resistor to provide a pull up on the RX pin. When not high I have had that block my code from running.