- Mon Apr 03, 2017 10:02 am
Since you put this in the newbie section I'll try to explain why it won't ever work (reliably). You have an HC12 receiver connected to the UART pins of the ESP8266 without any means of ensuring that you don't send junk to the ESP8266. By junk I include noise from the rf when you are not transmitting. How do you guarantee that the signal you send to the ESP8266 is high (the required default for the UART input) when there's no data on the readio channel? How do you guarantee that the radio channel doesn't break the bit timing of the data that you send? What happens to the ESP8266 when noise changes a valid command to an unrecognised command?
What is the default baud rate of the ESP8266? Are you sure its 9600 bps? The HC-12 is half-duplex, the ESP8266 is full-duplex so some things are going to get lost at least some of the time.
To have a chance of making this work you should begin by removing the radios between the Arduino and the ESP8266 and get that working so that you know you are speaking to the ESP8266 in the correct way. Then you can remove the ESP8266 and put the radios back with an arduino in place of the 8266 and see that the radio link works. Then you can attach the ESP8266 to the arduino and debug that setup.
It's the easiest to write the code for the Arduino and HC-12 directly on the ESP8266 and completely bypass the HC-12.
Get your ESP32 at EzSBC.com