problem with updating multiple fields on thingspeak channel simultaneously using nodemcu | ThingSpeak Projects | 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
problem with updating multiple fields on thingspeak channel simultaneously using nodemcu
No permission to create posts
July 30, 2019
4:23 am
Avatar
anitahk
New Member
Members
Forum Posts: 4
Member Since:
July 25, 2019
sp_UserOfflineSmall Offline

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

July 30, 2019
9:39 am
Avatar
Vinod

MathWorks
Members
Forum Posts: 339
Member Since:
May 1, 2016
sp_UserOfflineSmall Offline

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...

August 18, 2020
6:50 am
Avatar
kristenramirez
New Member
Members
Forum Posts: 1
Member Since:
August 18, 2020
sp_UserOfflineSmall Offline

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...

Forum Timezone: America/New_York

Most Users Ever Online: 166

Currently Online:
13 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:

khanhNguyen_CT, susyburr, quijano__, meosuckhoe, briskpanda, Dejw0089

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457