0

I'm having some problems with my ESP8266 stopping transmission of MQTT messages after a while. Therefore I'm writing some error handling messages, and I want to publish some AT data to MQTT.

It's probably a simple solution, but how can I, though the code, send AT messages from my 'own' device? Also, does AT messages get parsed at a higher level than any other user input, so it can't get stuck in any user made input loop?

Many thanks!

  • How do I send the message to myself, though, can I write to the input buffer that belongs to the serial connection? – Vincent Vega Mar 18 '19 at 9:44
  • I'm gonna have a loop in my Arduino code, so that if the unit doesn't transmit any sensor data for 2000ms, it will try to transmit diagnostic data provided by AP commands, so I need to read them as a c string. If I could read AP commands by mqtt subscription, that would also be quite interesting. – Vincent Vega Mar 18 '19 at 10:36
1

The AT command set for the ESP8266 is implemented through custom firmware which has to be flashed to the chip to use.

If you've written your own software which is running on the ESP8266 then that's what's flashed to it - the AT command set will not be available because you've overwritten it with your own software. So there's no way to send AT commands to yourself because if you've written software that could do that, then it's present and the AT command-interpreting software is not.

In that case you should look deeper into the Arduino core for the ESP8266 to find the equivalents to the AT commands you wanted to use. This is the code that calls setup() and loop() and implements Arduino-compatible functions like pinMode(). It also provides libraries like ESP8266WiFi. There are many un- and under-documented functions in the code. You can almost certainly find the equivalents to anything that you can do with an AT command in here.

| improve this answer | |
  • Thanks, that's pretty much what I was confused about! I'm sure I can do without.. – Vincent Vega Mar 19 '19 at 19:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.