Wemos D1 mini LED-Strip Slider-Button SmartHome

Slider to control Led-brightness

I bought some LED-Stripes with 3 Volt. And thought about it to control it with Cayenne.

The Slider-Button is a great function to control the brightness.

I will build the Stripe under a shelf in the kitchen. But this later…

(general introduction, overall experience with Cayenne, why did you create this project??)

You need,

1 Wemos or similar with Wifi

1 Led-Stripe 3 Volt

06

The Code

#define CAYENNE_PRINT Serial  // Comment this out to disable prints and save space
#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;


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

void loop()
{
  Cayenne.loop();
}

// This function is called when data is sent from Cayenne.
CAYENNE_IN(1)
{
  int value = getValue.asInt(); // 0 to 255
  CAYENNE_LOG("Channel %d, pin %d, value %d", 1, 5, value);
  // Write the value received to the PWM pin. analogWrite accepts a value from 0 to 255.
  analogWrite(5, value);
}
CAYENNE_IN_DEFAULT()
{
  CAYENNE_LOG("CAYENNE_IN_DEFAULT(%u) - %s, %s", request.channel, getValue.getId(), getValue.asString());
  //Process message here. If there is an error set an error message using getValue.setError(), e.g getValue.setError("Error message");
}

Much Fun its a cheap SmartHome solution…

7 Likes

Nice project!

Great stuff! We shared this on our Twitter page. :slight_smile: https://twitter.com/CayenneIoT/status/958789792778543104

1 Like

WOW, thanks to Cayenne. I will do my best to post some great builds more…

2 Likes

Looking forward to seeing your future Cayenne projects!