Unable to send and visualize data on my channel | ThingSpeak API | 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
Unable to send and visualize data on my channel
No permission to create posts
January 29, 2020
9:42 am
Avatar
TamaraRa
New Member
Members
Forum Posts: 1
Member Since:
January 29, 2020
sp_UserOfflineSmall Offline

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.

February 4, 2020
3:56 pm
Avatar
cstapels
Moderator
Members


Moderators
Forum Posts: 815
Member Since:
March 7, 2017
sp_UserOfflineSmall Offline

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.

Forum Timezone: America/New_York

Most Users Ever Online: 166

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

Tsfjacek, raji, ak71vie, dikshakakade, kainat, sachintour7

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457