1 (edited by zgs.tamutis 2020-12-29 20:41:43)

Topic: WS2812B How do I control my leds? SOLVED!!!

So I can't get my WS2812B leds to work with the sliders or rgb controls
Can you help me?




/*
   -- New project --
   
   This source code of graphical user interface
   has been generated automatically by RemoteXY editor.
   To compile this code using RemoteXY library 2.4.3 or later version
   download by link http://remotexy.com/en/library/
   To connect using RemoteXY mobile app by link http://remotexy.com/en/download/                   
     - for ANDROID 4.5.1 or later version;
     - for iOS 1.4.1 or later version;
   
   This source code is free software; you can redistribute it and/or
   modify it under the terms of the GNU Lesser General Public
   License as published by the Free Software Foundation; either
   version 2.1 of the License, or (at your option) any later version.   
*/
#include "FastLED.h"

#define LED_TYPE WS2812B
#define LED_PIN 3
#define BRIGHTNESS 255
#define NUM_LEDS 9
#define COLOR_ORDER GRB

CRGB leds[NUM_LEDS];

//////////////////////////////////////////////
//        RemoteXY include library          //
//////////////////////////////////////////////

// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_CLOUD
#include <ESP8266WiFi.h>

#include <RemoteXY.h>

// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "MEZON-B310-900B"
#define REMOTEXY_WIFI_PASSWORD "A0MYFH31LET"
#define REMOTEXY_CLOUD_SERVER "cloud.remotexy.com"
#define REMOTEXY_CLOUD_PORT 6376
#define REMOTEXY_CLOUD_TOKEN "df32d1ba1ad328e741be3b0c647f11d9"


// RemoteXY configurate 
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,6,0,0,0,30,0,10,13,1,
  7,52,10,8,20,5,2,26,2,7,
  52,10,28,20,5,2,26,2,7,52,
  9,44,20,5,2,26,2 };
 
// this structure defines all the variables and events of your control interface
struct {

    // input variables
  int16_t r;  // 32767.. +32767
  int16_t g;  // 32767.. +32767
  int16_t b;  // 32767.. +32767

    // other variable
  uint8_t connect_flag;  // =1 if wire connected, else =0

} RemoteXY;
#pragma pack(pop)

/////////////////////////////////////////////
//           END RemoteXY include          //
/////////////////////////////////////////////



void setup()
{
  RemoteXY_Init ();
 
 
  // TODO you setup code
  FastLED.addLeds<WS2812B, LED_PIN, RGB>(leds, NUM_LEDS);
 
}

void loop()
{
  RemoteXY_Handler ();
 
  leds[1]=CRGB(RemoteXY.r,RemoteXY.g,RemoteXY.b);
  // TODO you loop code
  // use the RemoteXY structure for data transfer
  // do not call delay()


}

2

Re: WS2812B How do I control my leds? SOLVED!!!

Nevermind I forgot big_smile

It's been a while since I programmed those fastled leds so I forgot very important line fastLED.show() :DDDD

Anyway turns out that to get the right value from sliders( by default they give out -48 to 52) I needed to do some maths

Anyway solved