Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define REMOTEXY_MODE__ESP8266WIFI_LIB_POINT
- #include <ESP8266WiFi.h>
- #include <RemoteXY.h>
- // RemoteXY connection settings
- #define REMOTEXY_WIFI_SSID "Maturita"
- #define REMOTEXY_WIFI_PASSWORD "maturita"
- #define REMOTEXY_SERVER_PORT 6377
- // RemoteXY configurate
- #pragma pack(push, 1)
- uint8_t RemoteXY_CONF[] =
- { 255,4,0,0,0,36,0,8,24,2,
- 6,0,4,5,50,50,7,2,50,50,
- 24,24,2,1,60,23,34,16,4,63,
- 55,21,1,8,31,31,79,78,0,79,
- 70,70,0 };
- // 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
- uint8_t switch_1; // =1 if switch ON and =0 if OFF
- // 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);
- int rain;
- int stav;
- void setup()
- {
- RemoteXY_Init ();
- strip.begin(); // INITIALIZE NeoPixel strip object (REQUIRED)
- strip.show(); // Turn OFF all pixels ASAP
- strip.setBrightness(150); // Set BRIGHTNESS to about 1/5 (max = 255)
- }
- void loop() {
- {
- RemoteXY_Handler();
- static uint8_t prevR = RemoteXY.LOOL_r;
- static uint8_t prevG = RemoteXY.LOOL_g;
- static uint8_t prevB = RemoteXY.LOOL_b;
- if (RemoteXY.switch_1!=0) {
- rain = 1;
- stav = 1;
- goto skoc;
- } else {
- stav = 0;
- if ( RemoteXY.LOOL_r != prevR || RemoteXY.LOOL_g != prevG || RemoteXY.LOOL_b != prevB )
- {
- prevR = RemoteXY.LOOL_r;
- prevG = RemoteXY.LOOL_g;
- prevB = RemoteXY.LOOL_b;
- colorWipe( strip.Color( RemoteXY.LOOL_r, RemoteXY.LOOL_g, RemoteXY.LOOL_b ));
- }
- }
- }
- skoc:
- switch(rain) {
- case 1:
- for(long firstPixelHue = 0; firstPixelHue < 2*65536; firstPixelHue += 256) {
- if (RemoteXY.switch_1==0) { break;}
- for(int i=0; i<strip.numPixels(); i++) { // For each pixel in strip...
- int pixelHue = firstPixelHue + (i * 65536L / strip.numPixels());
- strip.setPixelColor(i, strip.gamma32(strip.ColorHSV(pixelHue)));
- }
- strip.show(); // Update strip with new contents
- }
- break;
- }
- }
- void colorWipe(uint32_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
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement