4:23 am

July 25, 2019

Hello friends,
I have started working on IoT projects recently. Plz help me in this regard.
I have written the following code to write/update the multiple data fields on Thingspeak channel simultaneously. But sometimes it updates all the fields and sometimes it updates only the first field. please I need help in this regard. I am working on college projects on IOT
#include ;
#include ;
#include ;
const char* ssid = "Computronics"; //Your Network SSID
const char* password = "asd941967"; //Your Network Password
WiFiClient client;
unsigned long myChannelNumber = 835361; //Your Channel Number (Without Brackets)
const char * myWriteAPIKey = "17DLAQVQ9UYVCGC4"; //Your Write API Key
void setup()
{
Serial.begin(9600);
delay(10);
// Connect to WiFi network
WiFi.begin(ssid, password);
ThingSpeak.begin(client);
}
void loop()
{
int val1 = 900; //Read Analog values and Store in val variable
int val2 = 1000;
int val3 = 500;
int val4 = 200;
ThingSpeak.writeField(myChannelNumber, 1,val1, myWriteAPIKey); //Update in ThingSpeak
ThingSpeak.writeField(myChannelNumber, 2,val2, myWriteAPIKey);
ThingSpeak.writeField(myChannelNumber, 3,val3, myWriteAPIKey); //Update in ThingSpeak
ThingSpeak.writeField(myChannelNumber, 4,val4, myWriteAPIKey);
delay(15000);
}
regards
Anita H.k
9:39 am


MathWorks
May 1, 2016

Have you taken a look at the examples that come with the ThingSpeak Client Libraries? https://github.com/mathworks/thingspeak-arduino
You need to do a bunch of setFields followed by a single writeField. The examples will really be helpful in getting started...
6:50 am

August 18, 2020

Vinod said
Have you taken a look at the examples that come with the ThingSpeak Client Libraries? https://github.com/mathworks/thingspeak-arduino hireessaywriter
You need to do a bunch of setFields followed by a single writeField. The examples will really be helpful in getting started...
I don't know whether it'll help but I always start with a working example then gradually modify it to work the way I want...
Most Users Ever Online: 166
Currently Online:
35 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
rw950431: 272
Vinod: 240
piajola: 95
turgo: 70
vespapierre: 63
Adarsh_Murthy: 62
Member Stats:
Guest Posters: 1
Members: 8665
Moderators: 1
Admins: 2
Forum Stats:
Groups: 3
Forums: 14
Topics: 1600
Posts: 5760
Newest Members:
Advantagetreeexperts, laundrydaddyuk, techhhelp5, ken, tran, huldacormierModerators: cstapels: 460
Administrators: Hans: 405, lee: 457