I want my Arduino work with MQTT, so I have connected a ESP 01. I have encountered many problems with ESP 01 so I moved to Adafruit Huzzah breakout board. I have used I2C communication between Arduino and HUZZAH. It works fine for me. But every time I need to write two codes one as a slave and master. Is there any way that I can use these devices with one code, I mean just like I use a ESP 01 module. Please let me know if it is possible.
I don't have experience with I2C so maybe there's a way to do that via the protocol but here's my take:
There are macros defined for each architecture. Since your boards have different architecture you can use these macros to enable the appropriate code for the board it's running on. For example, if the "Arduino" board is an AVR(Uno, Mega, Leonardo, Nano, Pro Mini, etc.):
#ifdef __AVR__
// write AVR board specific code here
#else
// write ESP8266 board specific code here
#endif