not getting the graph

조회 수: 6 (최근 30일)
grishma dabhi
grishma dabhi 2019년 10월 1일
댓글: Vinod 2019년 10월 21일
i am uploading a code for mq135 gas sensor and node mcu. But the graph is not displayed in Thingspeak.any one can help please?the code is here
#include<ThingSpeak.h>
#include <WiFiClient.h>;
#include <SPI.h>
#include "MQ135.h"
#include <ESP8266WiFi.h>
const char *apiKey = "1CUJEV41WNM7WHHP"; // Enter your Write API key from ThingSpeak
const char *ssid = "Harrin"; // replace with your wifi ssid and wpa2 key
const char *pass = "harrin20";
const char* server = "api.thingspeak.com";
WiFiClient client;
unsigned long myChannelNumber = 876579;
byte mac[] = { 0xDE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED};
#define VOLTAGE_MAX 5.0
#define VOLTAGE_MAXCOUNTS 1023.0
void setup() {
Serial.begin(9600);
delay(10);
Serial.println("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
ThingSpeak.begin(client);
}
void loop() {
// read the input on analog pin 0:
int sensorValue = analogRead(A0);
// Convert the analog reading
// On Arduino: 0 - 1023 maps to 0 - 5 volts
// On ESP8266: 0 - 1023 maps to 0 - 1 volts
// On Particle: 0 - 4095 maps to 0 - 3.3 volts
float voltage = sensorValue * (VOLTAGE_MAX / VOLTAGE_MAXCOUNTS);
Serial.print(voltage);
Serial.println();
delay(10000); // ThingSpeak will only accept updates every 15 seconds
ThingSpeak.writeField(myChannelNumber, 1,voltage, apiKey); //Update in ThingSpeak
delay (100);
  댓글 수: 2
Walter Roberson
Walter Roberson 2019년 10월 2일
darova: note that ThinkSpeak is a Mathworks product; https://www.mathworks.com/products/thingspeak.html
Vinod
Vinod 2019년 10월 21일
Have you confirmed your device is able to the internet? What do you see in the serial monitor?

댓글을 달려면 로그인하십시오.

답변 (0개)

커뮤니티

더 많은 답변 보기:  ThingSpeak 커뮤니티

카테고리

Help CenterFile Exchange에서 REST API에 대해 자세히 알아보기

제품

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by