9:42 am

January 29, 2020

Hello,
I found simple example and tried to make it work. Based on what i see on serial monitor, code is working but the data are not visible on my channel.
If I go to https://api.thingspeak.com/update?api_key=XXXXXXXXXXXXXX&field7=1200 with my writing key, I can see that my entries increases.
Can someone help me, what could be the problem here?
Code is below:
#include "ThingSpeak.h"
#include
#include
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
EthernetClient client;
// On Arduino: 0 - 1023 maps to 0 - 5 volts
#define VOLTAGE_MAX 5.0
#define VOLTAGE_MAXCOUNTS 1023.0
unsigned long myChannelNumber = XXXXXX;
const char * myWriteAPIKey = "XXXXXXXXXXXXXXXX";
void setup()
{
Serial.begin(9600);
Ethernet.begin(mac);
ThingSpeak.begin(client);
}
void loop()
{
// int sensorValue = analogRead(A0);
int sensorValue = random(0,1023);
float voltage = sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
Serial.println(sensorValue);
Serial.println(voltage);
// Write to ThingSpeak. There are up to 8 fields in a channel, allowing you to store up to 8 different
// pieces of information in a channel. Here, we write to field 1.
ThingSpeak.writeField(myChannelNumber, 1, voltage, myWriteAPIKey);
delay(20000); // ThingSpeak will only accept updates every 15 seconds.
3:56 pm


Moderators
March 7, 2017

Do you have all the fields enabled for your channel? I see your test write is to field 7, but in the code you write to field 1. If you read back the data, do you see any null entries?
FYI, MATLAB answers is now the preferred location for ThingSpeak Community support.
Most Users Ever Online: 166
Currently Online:
21 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:
estebanmateo93, mikewrite, onlinebusiness, winzy99, Zark_zeugan, StefanWiModerators: cstapels: 460
Administrators: Hans: 405, lee: 457