ESP8266 Nodemcu Slider Coding Issue

Hello all!

I am very new to Cayenne and Arduino coding as a whole and I am currently facing an issue working the slider widget on Cayenne with the ESP8266 Nodemcu 0.9. The issue is that when I move my slider, the values aren’t updating in the code. Beyond this issue, I am have troubles seeing my sensor, HX711, data on the dashboard. Any help is MUCH appreciated as soon as possible. This is for a project due ASAP. Please refer to the code below. Thank you Cayenne Community!

// This example shows how to connect to Cayenne using an ESP8266 and send/receive sample data.
// Make sure you install the ESP8266 Board Package via the Arduino IDE Board Manager and select the correct ESP8266 board before compiling.

#define CAYENNE_PRINT Serial
#include <CayenneMQTTESP8266.h>
//#include <CayenneMQTTClient.h>
#include <HX711.h>
#define Buzzerout D2 //D2
#define DOUT D4 //D4
#define CLK D5 //D5
#define LEDout D6 //D6

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

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

Network network;
CayenneMQTTClient mqttClient;


HX711 scale;
float calibration_factor=5220;
float units;
float ounces;
float percent_load = .10;
float person_weight = 170;
float weightmath;
float notifmethod=1;

unsigned long lastMillis = 0;
// SETUP //
void setup() {
Cayenne.begin(username, password, clientID, ssid, wifiPassword);
scale.begin(DOUT, CLK);
pinMode(Buzzerout, OUTPUT);
digitalWrite(Buzzerout, HIGH);

// LOOP //
void loop() {
weightmath=(percent_load * person_weight);
units=(scale.get_units(10), 1);
if (units < 0){
units= 0.00;
// Insert an if statement here which select this notification method
if (units > weightmath){
digitalWrite(Buzzerout, LOW);
digitalWrite(Buzzerout, HIGH);
} Serial.println(weightmath);

// Default function for sending sensor data at intervals to Cayenne.
// You can also use functions for specific channels, e.g CAYENNE_OUT(1) for sending channel 1 data.
// Write data to Cayenne here. This example just sends the current uptime in milliseconds on virtual channel 0.
//Cayenne.virtualWrite(0, millis());

Cayenne.virtualWrite(0, weightmath);

CayenneMQTTPublishDataFloat(&mqttClient, NULL, DATA_TOPIC, 0, “VALUE”, “ANALOG”, weightmath);

//Cayenne.virtualWrite(3, units);
//Cayenne.virtualWrite(4, percent);

// Default function for processing actuator commands from the Cayenne Dashboard.
// You can also use functions for specific channels, e.g CAYENNE_IN(1) for channel 1 commands.

CAYENNE_LOG(“Channel %u, value %s”,, getValue.asString());
//Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError(“Error message”);
int PersWght = getValue.asInt();
person_weight = (PersWght);
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL, person_weight);
analogWrite(DOUT, person_weight);

int PersPcnt = getValue.asInt();
percent_load = (PersPcnt);
CAYENNE_LOG(“Channel %d, pin %d, value %d”, VIRTUAL_CHANNEL2, percent_load);
analogWrite(DOUT, percent_load);

Before trying the cayenne code, can you try the HX711 code alone to see if you are getting data from the sensor.

why are you using this line?