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

Avatar

Please consider registering
Guest

sp_LogInOut Log In sp_Registration Register

Register | Lost password?
Advanced Search

— Forum Scope —






— Match —





— Forum Options —





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

sp_Feed sp_TopicIcon
i have 4 TS channels, how to update 16 values via one Arduino sketch?
No permission to create posts
May 28, 2016
8:13 am
Avatar
dave1829
New Member
Members
Forum Posts: 1
Member Since:
May 28, 2016
sp_UserOfflineSmall Offline

 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?

May 29, 2016
10:24 pm
Avatar
rw950431

Top
Members
Forum Posts: 262
Member Since:
January 30, 2014
sp_UserOfflineSmall Offline

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:
20 Guest(s)

Currently Browsing this Page:
1 Guest(s)

Top Posters:

rw950431: 261

Vinod: 196

piajola: 85

turgo: 70

vespapierre: 63

Adarsh_Murthy: 62

Member Stats:

Guest Posters: 1

Members: 5703

Moderators: 0

Admins: 2

Forum Stats:

Groups: 4

Forums: 17

Topics: 1313

Posts: 4565

Newest Members:

BarryMaync, ThomasRougs, DonaldGen, prince, JrGordon, Elamsweems

Administrators: Hans: 387, lee: 457