Hi, I am new to embedded development and I am stuck at an problem that I can’t figure out by reading the documentation. I am developing an IOT project as part of an school assignment. I have a github repository with the source code of the project and I am trying to setup Travis CI. Everything worked fine when all the code lived in the main.cpp file but after moving parts of the code to separate classes in the lib
directory the build kept failing. The problem is that it doesn’t find my classes.
English is not my native language so it could be that I am misunderstanding something in the documentation. Is there somebody that knows what I am doing wrong? I would appreciate any help or suggestions maybe an part of the documentation that I should take an closer look at, Thanks in advance!
An link to my repository WaterUp-PlantPot
src/main.cpp:9:82: fatal error: MQTT.h: No such file or directory
#include <MQTT.h>
My directory structure
|--lib
| |--MQTT
| |- MQTT.cpp
| |- MQTT.h
| |--Sensors
| | |- Sensors.cpp
| | |- Sensors.h
|- platformio.ini
|- .travis.yml
|--src
|- main.c
The main.cpp file:
#include <Arduino.h>
#include <MQTT.h>
#include <Sensors.h>
MQTT mqtt; // Create an new MQTT object for communication with the broker.
Sensors sensors; // Create an new Sensors object for taking measurements about the pot state.
void setup()
{
Serial.begin(115200); // Start serial communication for sending debug messages to the serial port.
delay(10);
mqtt.setup( &sensors ); // Setup the mqtt library.
}
void loop()
{
mqtt.mqttConnect(); // Connect to the broker if the connection is lost.
mqtt.runLoop(); // Run the main program.
}
My travis.yml file:
language: python
python:
- "2.7"
sudo: false
cache:
directories:
- "~/.platformio"
env:
- PLATFORMIO_CI_SRC=./src/main.cpp
install:
- pip install -U platformio
- platformio lib -g install "Adafruit MQTT Library"
- platformio lib -g install Streaming
script:
- platformio ci --board=huzzah