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

Avatar

Please consider registering
Guest

Search

— Forum Scope —






— Match —





— Forum Options —





Minimum search word length is 3 characters - maximum search word length is 84 characters

Register Lost password?
sp_Feed sp_TopicIcon
i have 4 TS channels, how to update 16 values via one Arduino sketch?
Avatar
dave1829
New Member
Forum Posts: 1
sp_UserOfflineSmall Offline
1
May 28, 2016 - 8:13 am
sp_Permalink sp_Print

 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?

Avatar
rw950431

Forum Posts: 252
sp_UserOfflineSmall Offline
2
May 29, 2016 - 10:24 pm
sp_Permalink sp_Print

Did you look at the "WriteMultipleVoltages" example from the TS library? Even if you solve your compile errors it wont work because TS limits updates to one every 15 seconds per channel so only the field 1 update will succeed.

Its possible you have the wrong board type set, can you compile and run any of the example programs that came with the library? I always find that getting the examples to run is a good way to ensure your environment is set up correctly.

Alternatively I note that the examples use "float" for the value but the error implies you supply "double" - perhaps this is tripping up the compiler?

Forum Timezone: America/New_York

Most Users Ever Online: 114

Currently Online: jacktheripper125
18 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 252

Vinod: 164

cstapels: 96

piajola: 75

vespapierre: 63

Adarsh_Murthy: 59

Newest Members:

Nsneilotof

angieus2

goldiepw11

BinanceoSt

gnarender123@gmail.com

edenderest

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

 

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Administrators: Hans, lee