First of all, let me introduce myself and say that this is my first port on this community.
I’ve been programing arduinos and esp8266 for a couple of years. During all that time I was using Arduino IDE, and recently I’ve decided to move all my new programming to PlatformIO (+Atom).
I’m currently upgrading the code of my small meteo station and decided to go with PlatformIO.
I’ve already re-wrote a lot of the code, but now I need your support.
Currently I have several CPP files, since I’m trying to keep the code segmented so I can reuse the segments in other projects.
To this matter, let’s consider I have 3 CPP files, the main.cpp with all the basic code, the wifi.cpp with the code related to wifi connection and the mqtt.cpp with the code related to the mqtt client.
My issue is the following:
- At wifi.cpp I’m creating the wifi connection
#include <ESP8266WiFiMulti.h> // Include the Wi-Fi-Multi library ESP8266WiFiMulti wifiMulti; // Create an instance of the ESP8266WiFiMulti class, called 'wifiMulti'
- At mqtt.cpp I need to create the mqtt connection, but for that I need to call wifiMulti from the wifi.cpp. The code below is giving an error (‘wifiMulti’ was not declared in this scope)
`
PubSubClient mqttclient(wifiMulti);
`
HOW should I do to call it?
This is probably a rookie question…
Thank you