Sending data from NodeMCU but channel graph does not update | ESP Wi-Fi | 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
Sending data from NodeMCU but channel graph does not update
No permission to create posts
February 21, 2019
1:37 am
Avatar
harpsler
New Member
Members
Forum Posts: 1
Member Since:
February 21, 2019
sp_UserOfflineSmall Offline

The number of entries are increasing but there's nothing on the graph. The serial monitor also shows that data is being uploaded. please help.
Channel number 709360

#include
#include
#include
#include
#define LED D4 // Led in NodeMCU at pin GPIO16 (D0).
Servo servo_test;
int gas = A0;
int angle=0;
const char* ssid = "**************";
const char* password = "**************";
WiFiClient client;
unsigned long myChannelNumber = 709360;
const char * myWriteAPIKey = "*************";
void setup()
{
pinMode(D0,OUTPUT);
pinMode(D1,OUTPUT);
pinMode(gas,INPUT);
servo_test.attach(D2);
Serial.begin(115200);
delay(10);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);

Serial.print(";");
}
pinMode(LED, OUTPUT); // set the digital pin as output.
digitalWrite(LED, HIGH);// turn the LED off.(Note that LOW is the voltage level but actually
//the LED is on; this is because it is acive low on the ESP8266.
delay(1000); // wait for 1 second.
digitalWrite(LED, LOW); // turn the LED on.

Serial.println("");
Serial.println("WiFi connected");
// Print the IP address
Serial.println(WiFi.localIP());
ThingSpeak.begin(client);
}
void loop()
{
static boolean data_state = true;
int sensorValue = analogRead(gas);
float a = sensorValue*(5.0/1023.0);
if(a>1)
{
ThingSpeak.writeField(myChannelNumber, 2,a , myWriteAPIKey);
Serial.println("uploaded");
digitalWrite(D1,LOW);
digitalWrite(D0,HIGH);
for(angle = 0; angle < 180; angle += 1) // command to move from 0 degrees to 180 degrees
{
servo_test.write(angle); //command to rotate the servo to the specified angle
delay(15);
}
}
else
{
digitalWrite(D0,LOW);
digitalWrite(D1,HIGH);
ThingSpeak.writeField(myChannelNumber, 2,a , myWriteAPIKey);
Serial.println("uploaded");
}
Serial.println(a);
delay(1000);

// 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.
delay(1000); // ThingSpeak will only accept updates every 1 second.
}

February 25, 2019
8:33 am
Avatar
cstapels
Moderator
Members


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

I see data at https://thingspeak.com/channels/709360 from Monday morning.
Here is the last data point:

{
"created_at": "2019-02-25T11:44:09Z",
"entry_id": 8153,
"field1": "0.51808"
}

Are you able to view data on your plots now?

There is a pencil icon on the upper right of the ThingSpeak plot, you can use that to change the plot settings. You can change results or days (but don't use both) to change the x-axis. There are also range adjustments for the y-axis. They will auto scale by default.

Forum Timezone: America/New_York

Most Users Ever Online: 166

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

briskpanda, Dejw0089, Yassine Ben Salah, anis, 43994554AKS, suda

Moderators: cstapels: 460

Administrators: Hans: 405, lee: 457