Quantcast
Channel: ThingSpeak IoT Community - Forum: Arduino
Viewing all articles
Browse latest Browse all 172

dave1829 on i have 4 TS channels, how to update 16 values via one Arduino sketch?

$
0
0

 i have tried so many iterations!

for example:

#include "ThingSpeak.h"

unsigned long upstairsPlenumCh1APIKeyChNum = xx;
const char * upstairsPlenumCh1APIKey = "123";

unsigned long upstairsPlenumCh2APIKeyChNum = yy;
const char * upstairsPlenumCh2APIKey = "456";

unsigned long upstairsPlenumCh3APIKeyChNum = zz;
const char * upstairsPlenumCh3APIKey = "789";

unsigned long upstairsPlenumCh4APIKeyChNum = ww;
const char * upstairsPlenumCh4APIKey = "987";

then do stuff

then:

void dataLoggingThingspeakCh1()
{ //sends the Ch1 variables to Thingspeak
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 1, medianRoofTemp, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 2, roofVapourPres, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 3, medianHouseTemp, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 4, houseVapourPres, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 5, medianExternTemp, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 6, externVapourPres, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 7, medianLivingTemp, upstairsPlenumCh1APIKey);
ThingSpeak.writeField(upstairsPlenumCh1APIKeyChNum, 8, livingVapourPres, upstairsPlenumCh1APIKey);

}

void dataLoggingThingspeakCh2()
{ //sends the Ch2 variables to Thingspeak
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 1, medianBed1Temp, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 2, bed1VapourPres, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 3, medianBed2Temp, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 4, bed2VapourPres, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 5, roofDewPoint, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 6, houseDewPoint, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 7, externDewPoint, upstairsPlenumCh2APIKey);
ThingSpeak.writeField(upstairsPlenumCh2APIKeyChNum, 8, livingDewPoint, upstairsPlenumCh2APIKey);

}

void dataLoggingThingspeakCh3()
{ //sends the Ch3 variables to Thingspeak
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 1, bed1DewPoint, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 2, bed2DewPoint, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 3, setTarget, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 4, setCooling, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 5, setWarming, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 6, setShutOffFunction, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 7, setLivingOutlet, upstairsPlenumCh3APIKey);
ThingSpeak.writeField(upstairsPlenumCh3APIKeyChNum, 8, setBedsOutlet, upstairsPlenumCh3APIKey);

dataLoggingThingspeakCh4();
}

void dataLoggingThingspeakCh4()
{ //sends the Ch4 variables to Thingspeak
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 1, closeLivingOutlet, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 2, closeBedroomsOutlet, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 3, setToiletOff, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 4, upstairsPlenumSmoke, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 5, upstairsPlenumCO2, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 6, basementPlenumSmoke, upstairsPlenumCh4APIKey);
ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 7, basementPlenumCO2, upstairsPlenumCh4APIKey);
// ThingSpeak.writeField(upstairsPlenumCh4APIKeyChNum, 8,NEWVARIABLE, upstairsPlenumCh4APIKey);

}

 

but getting error:

call of overloaded 'writeField(long unsigned int&, int, double&, const char*&)' is ambiguous

any suggestions?


Viewing all articles
Browse latest Browse all 172

Trending Articles