Hello, I’m having this issue with my code where it gives me the following error abc.ino:60:61: no matching function for call to ‘String::String(__gnu_cxx::__alloc_traits<std::allocator<std::__cxx11::basic_string<char> > >::value_type&)’
I really am just completely lost as to what to do here to fix this. If anyone could please help.
// This #include statement was automatically added by the Particle IDE.
#define ARDUINOJSON_ENABLE_ARDUINO_STRING 1
#include <ArduinoJson.h>
//#include "ArduinoJson.h"
//#include "Particle.h"
//#include "Arduino.h"
//#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
std::vector<std::string> userVariables;
class chords
{
private:
public:
String test;
chords();
~chords();
std::string url;
std::string apikey;
std::string email;
std::string sensorid;
void addVariable(const std::string vName, const std::string vValue);
void removeVariable(std::string &vName, std::string &vValue);
void removeValue_V(std::string &vValue);
void stream(std::vector<std::string>&userVariables);
};
chords::chords()
{
}
chords::~chords()
{
}
//function defentitions
void chords::addVariable(const std::string vName, const std::string vValue)
{
userVariables.push_back(vName);
userVariables.push_back(vValue);
}
chords testchord;
void setup() {
testchord.addVariable("Test", "test");
//testchord.stream(userVariables);
for (int i=0; i<=userVariables.size(); i++)
{
Particle.publish("blabla" , String(userVariables.at(i)), PRIVATE);
}
}
void loop(){
}
/*void chords::removeVariable(std::string &vName, std::string &vValue)
{
userVariables.erase(std::remove(userVariables.begin(), userVariables.end(), vName), userVariables.end());
userVariables.erase(std::remove(userVariables.begin(), userVariables.end(), vValue), userVariables.end());
}
void chords::stream(std::vector<std::string>&userVariables)
{
const size_t capacity = JSON_ARRAY_SIZE(8) + JSON_OBJECT_SIZE(16) + 30;
DynamicJsonDocument jsondata(capacity);
Particle.publish("Test 1", "test 1 complete");
std::string vectorData;
for(int i = 0; i > userVariables.size(); i++)
{
Particle.publish("Test 2", "test 2 complete");
if(userVariables.size() < 0)
{
Particle.publish("error", "error");
}
else
{
userVariables.at(i) = vectorData;
jsondata[vectorData];
Particle.publish("Test 2.5", "test 2.5 complete");
}
}
Particle.publish("Test 3", "test 3 complete");
//serialization
String data;
serializeJson(jsondata, data);
Particle.publish("Whatever", data);
}*/
/*void chords::removeValue_V(std::string &vValue)
{
uservariables.erase(std::remove(uservariables.begin(), uservariables.end(), vValue), uservariables.end());
}*/