Topic: How work with RGB Color?
Hi, as a Arduino newbie I have a question. I want remote my WS2811 adressable led strip through RGB color panel. Best choice for me are three variables - red, green, blue - and work with them, but i dunno how to earn them. There is my in-progress sketch:
//////////////////////////////////////////////
// RemoteXY include library //
//////////////////////////////////////////////
// RemoteXY select connection mode and include library
#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
// RemoteXY connection settings
#define REMOTEXY_WIFI_SSID "RemoteXY"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377
// RemoteXY configurate
#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
{ 255,3,0,0,0,11,0,8,24,0,
6,0,20,4,55,55,24,24 };
// this structure defines all the variables of your control interface
struct {
// input variable
uint8_t LOOL_r; // =0..255 Red color value
uint8_t LOOL_g; // =0..255 Green color value
uint8_t LOOL_b; // =0..255 Blue color value
// other variable
uint8_t connect_flag; // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)
/////////////////////////////////////////////
// END RemoteXY include //
/////////////////////////////////////////////
#include <Adafruit_NeoPixel.h>
#define PIN 14
#define NUMPIXELS 100
#define LED_COUNT 60
Adafruit_NeoPixel strip(LED_COUNT, PIN, NEO_GRB + NEO_KHZ400);
void setup()
{
RemoteXY_Init ();
strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
strip.show(); // Turn OFF all pixels ASAP
strip.setBrightness(50); // Set BRIGHTNESS to about 1/5 (max = 255)
// TODO you setup code
}
void loop() {
RemoteXY_Handler ();
colorWipe( strip.Color( RemoteXY.LOOL_r, RemoteXY.LOOL_g, RemoteXY.LOOL_b ));
}
// TODO you loop code
// use the RemoteXY structure for data transfer
void colorWipe(uint8_t color) {
for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
strip.setPixelColor(i, color); // Set pixel's color (in RAM)
strip.show(); // Update strip to match
}
}
Thank you for all advices