Hcsr ultrasonic sensor+nodemcu

i m a new comer to cayenne.firstly i thank cayenne staff and community members to share the knowledge with us and good feed back to provide the student such as us. i made the water level visualizer using node mcu and ultrasonic sensor.code also get from here.i need to save the water level in excel sheet or any document.and also i need to make the graph in that worksheet.when power down data not be loss.level shows as percentage. pls help me.and i apologize from you because i m not fluent in English.code is

// This example shows how to connect to Cayenne using an Ethernet W5100 shield and send/receive sample data.

//#define CAYENNE_DEBUG
#define CAYENNE_DEBUG
#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>

// WiFi network info.
char ssid = “#####”;
char wifiPassword = “######”;

// Cayenne authentication info. This should be obtained from the Cayenne Dashboard.
char username = “########”;
char password = “##########”;
char clientID = “############”;

unsigned long lastMillis = 0;

// defines pins numbers

const int trigPin = 2; //D4
const int echoPin = 0; //D3

// defines variables
long duration;
int distance;
int y;

void setup() {
Cayenne.begin(username, password, clientID, ssid, wifiPassword);

pinMode(trigPin, OUTPUT); // Sets the trigPin as an Output
pinMode(echoPin, INPUT); // Sets the echoPin as an Input
Serial.begin(9600); // Starts the serial communication
}

void loop() {
Cayenne.loop();

// Clears the trigPin
digitalWrite(trigPin, LOW);
delayMicroseconds(2);

// Sets the trigPin on HIGH state for 10 micro seconds
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);

// Reads the echoPin, returns the sound wave travel time in microseconds
duration = pulseIn(echoPin, HIGH);

// Calculating the distance
distance = duration * 0.034 / 2;
// Prints the distance on the Serial Monitor
Serial.print("Distance: ");
Serial.println(distance);
y = map(distance, 95, 10, 0, 100);
y = constrain(y, 0, 100);
delay(500);
if (millis() - lastMillis > 10000) {
lastMillis = millis();
Cayenne.virtualWrite(10, distance);
Cayenne.virtualWrite(13, y, “t1”, “null”);
}
}

you can download the history data from cayenne dashboard.

Thanks for your feedback.When i was download there is a message in nothing matches criteria

i see there are no widgets added to your account. can you add the green temporary widget by clicking on + on the widget.

thanks. i add widget.can i put the tank view to widget?

what is the file format of download report?

Cayenne.virtualWrite(13, y, “t1”, “null”); should be Cayenne.virtualWrite(13, y, "tl", "null");

.xls format for windows and .csv on mac.

actually i m not fluent in arduino programing.can i explain the where the place i change that code

in your code, find Cayenne.virtualWrite(13, y, “t1”, “null”); and you only need to change "t1" to "tl"

Thanks.when power down the node mcu its not start when i remove the wire of hscr ultrasonic sensor.how to fix it?

i did not understand what you mean by it.

i switch off the node mcu board for few minutes.after that its going off line.then i remove the D3 and D4 then reset the programme.when i do that it connect to the wifi.before that it did not connect.

how to remove the other channel shows in the image.

you need to add the widget by clicking on green + of the widget.

I add it.bt its not working probably.

you want the channel 10 to be deleted? so from your code remove Cayenne.virtualWrite(10, distance);