1

Topic: How to use ESP8266 to control led strip

How to use ESP8266 to control led strip something I tried to do such a code I did so far everything should work but the phone does not see my LED network


#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>
#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif



#define REMOTEXY_WIFI_SSID "LED"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377

#define LED_PIN   6
#define LED_COUNT 3



#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,4,0,0,0,19,0,16,147,1,6,0,22,66,20,20,78,8,3,131,
  20,12,22,8,64,26 };
struct {
  uint8_t rgb_1_r;
  uint8_t rgb_1_g;
  uint8_t rgb_1_b;
  uint8_t Mode;
  uint8_t connect_flag;
} RemoteXY;
#pragma pack(pop)



Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup()
{
  #if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();           
  strip.show();           
  strip.setBrightness(50);
 
  RemoteXY_Init ();
  Serial.begin(9600);
  Serial.print("Start");
}



void loop()
{
  RemoteXY_Handler ();
  //Serial.println(RemoteXY.rgb_1_r);
  //Serial.println(RemoteXY.rgb_1_g);
  //Serial.println(RemoteXY.rgb_1_b);
  //Serial.println(RemoteXY.Mode);
 
  rainbow(10);
}



void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, color);
    strip.show();
    RemoteXY_delay(wait);
  }
}


void theaterChase(uint32_t color, int wait) {
  for(int a=0; a<10; a++) {
    for(int b=0; b<3; b++) {
      strip.clear();
      for(int c=b; c<strip.numPixels(); c += 3) {
        strip.setPixelColor(c, color);
      }
      strip.show();
      RemoteXY_delay(wait);
    }
  }
}


void rainbow(int wait) {
  for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
    strip.rainbow(firstPixelHue);
    strip.show();
    RemoteXY_delay(wait);
  }
}

2

Re: How to use ESP8266 to control led strip

Domyślnie miałem taki kod wygenerowany przez REMOTEXY

#define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
#include <ESP8266WiFi.h>
#include <RemoteXY.h>



#define REMOTEXY_WIFI_SSID "LED"
#define REMOTEXY_WIFI_PASSWORD "12345678"
#define REMOTEXY_SERVER_PORT 6377



#pragma pack(push, 1)
uint8_t RemoteXY_CONF[] =
  { 255,4,0,0,0,19,0,16,147,1,6,0,22,66,20,20,78,8,3,131,
  20,12,22,8,64,26 };
struct {
  uint8_t rgb_1_r; // =0..255 Red color value
  uint8_t rgb_1_g; // =0..255 Green color value
  uint8_t rgb_1_b; // =0..255 Blue color value
  uint8_t Tryby; // =0 if select position A, =1 if position B, =2 if position C, ...
  uint8_t connect_flag;  // =1 if wire connected, else =0
} RemoteXY;
#pragma pack(pop)



void setup()
{
  RemoteXY_Init ();
 



 
}



void loop()
{
  RemoteXY_Handler ();


 
}

3

Re: How to use ESP8266 to control led strip

A to jest kod który próbuję wsadzić do kodu z REMOTEXY Używa na NEOPIXEL


#include <Adafruit_NeoPixel.h>
#ifdef __AVR__
#include <avr/power.h>
#endif



#define LED_PIN   6
#define LED_COUNT 3



Adafruit_NeoPixel strip(LED_COUNT, LED_PIN, NEO_GRB + NEO_KHZ800);
void setup() {
#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000)
  clock_prescale_set(clock_div_1);
#endif
  strip.begin();           
  strip.show();           
  strip.setBrightness(50);
}



void loop() {
  rainbow(10);
}



void colorWipe(uint32_t color, int wait) {
  for(int i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, color);
    strip.show();
    delay(wait);
  }
}



void theaterChase(uint32_t color, int wait) {
  for(int a=0; a<10; a++) {
    for(int b=0; b<3; b++) {
      strip.clear();
      for(int c=b; c<strip.numPixels(); c += 3) {
        strip.setPixelColor(c, color);
      }
      strip.show();
      delay(wait);
    }
  }
}



void rainbow(int wait) {
  for(long firstPixelHue = 0; firstPixelHue < 5*65536; firstPixelHue += 256) {
    strip.rainbow(firstPixelHue);
    strip.show();
    delay(wait);
  }
}