I am using ESP8266 to receive data from serial communication from Arduino Uno, but then I am sending that values to arduino cloud with WIFI, and I want to do an chart with that values, and on the chart only shows zeros. I have tried so many thins, incluinding an random variable on the code and it writes the random numbers, but the data from Rx/Tx don´t do the chart. I will post here my code, what is wrong?
#include "thingProperties.h"
#include <iostream>
#include <string>
#include <ArduinoIoTCloud.h>
#include <Arduino_ConnectionHandler.h>
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
WiFi.setSleepMode(WIFI_NONE_SLEEP);
//randomSeed(analogRead(0));
while (!Serial) {
;
}
initProperties();
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
//randNumber = random(20);
delay(100);
if (Serial.available() > 0) {
power = Serial.parseInt();
//Serial.println(randNumber);
Serial.println(power);
}
}
This is a good thing to do to troubleshoot this sort of unexpected behavior from a sketch, but you didn't tell us what you learned after you added that debug output to the sketch.
When you send serial data to the board, do you see the expected values echoed back in the output field of Serial Monitor?
Click the following link to open the list of your Arduino Cloud Things in the web browser: https://app.arduino.cc/things
Click the name of the Thing.
The "Setup" page for the Thing will open.
On this page, you will see a list of the variables of your Thing. The type is shown on the line under the variable name. For example, in this Thing I created, you can see that the type of the led Variable is bool:
While the Thing sketch program is running on your board and you are seeing the expected values in Serial Monitor, do you also see the expected values under the "Last Value" column on that Thing setup page?: