Alaa in MATLAB Answers
上次活动时间: 2023-5-30

I'm working on a project that contains several distributed nodes. I assigned one channel for each node. my question is " how can I visualize the data coming from different channels on one page?
Nathan Garpiya in MATLAB Answers
上次活动时间: 2020-11-18

Hi i'm trying to send data on thinkspeak for 3 fields. But thingspeak is not showing any graphical representation despite entries. I reduced the update time to 10 and still didn't get anything This is my code: //Include the ESP8266 WiFi library. #include <ESP8266WiFi.h> //Local Network Settings. char ssid[] = "AndroidAP5723"; // your network SSID (name) char pass[] = "hookuyte"; // your network password const byte buttonPin = 4; const byte potentiometerPin = A0; char thingSpeakAddress[]= "api.thingspeak.com";// Host address URL String APIKey = "**************";//Blanked out for security reasons const int updateThingSpeakInterval = 20 * 1000;// every 20 secs //Initialize wifi client WiFiClient client; void setup() { //Set the baud rate for Serial Communication Serial.begin(115200); delay(2000); //Display what SSiD you are connecting to. Serial.println(); Serial.print("Connecting to "); Serial.println(ssid); //Connect to the Access. WiFi.begin(ssid,pass); //Now we establish a connection to the access point while(WiFi.status()!= WL_CONNECTED) { delay(500); Serial.print("."); } }//Close setup void loop() { //Read Sensor Data int potentiometerReading = analogRead(potentiometerPin); boolean buttonReading = digitalRead(buttonPin); //Convert sensor data into String objects String potentiometerField = String(potentiometerReading); String buttonField = String(buttonReading); String randomNumberField = String(random (0, 42)); /* Concatenate the field into one string object * which we can send as the Message body */ String thingSpeakData = "field1=" + potentiometerField+ "&field2=" + buttonField + "&field3=" + randomNumberField; //Establish a connection with ThingSpeak if(client.connect(thingSpeakAddress, 80)){ //Send the Message Start-Line (Method URI protocolVersion). client.println("POST /update HTTP/1.1"); //Send the HTTP Header Field client.println("Host: api.thingspeak.com"); client.println("Connection: close"); client.println("X-THINGSPEAKAPIKEY: " + APIKey); client.println("Contect-Type: application/x-www-form-urlencoded"); client.print("Content-Lenght: "); client.println(thingSpeakData.length()); client.println();// Header fields are complete //Send Message Body client.print(thingSpeakData); //check if connection to thingSpeak was established if (client.connected()){ Serial.println("Connected to thingSpeak."); Serial.println(); } //Display info to Serial Monitor for troublShooting Serial.print("Potentiometer [Field 1]= " ); Serial.print(potentiometerField); Serial.print(" Button [Field 2] = " ); Serial.print(buttonField); Serial.print(" Random [Field 3] = " ); Serial.print(randomNumberField); delay(updateThingSpeakInterval); } }

关于 ThingSpeak

The community for students, researchers, and engineers looking to use MATLAB, Simulink, and ThingSpeak for Internet of Things applications. You can find the latest ThingSpeak news, tutorials to jump-start your next IoT project, and a forum to engage in a discussion on your latest cloud-based project. You can see answers to problems other users have solved and share how you solved a problem.