├── RGB_WS2812_Light ├── lib │ ├── lightLib │ │ ├── myTypes.c │ │ └── myTypes.h │ ├── Metro │ │ ├── .svn │ │ │ ├── prop-base │ │ │ │ ├── Metro.h.svn-base │ │ │ │ ├── Metro.cpp.svn-base │ │ │ │ ├── about.txt.svn-base │ │ │ │ ├── keywords.txt.svn-base │ │ │ │ └── Metro.pdf.svn-base │ │ │ ├── text-base │ │ │ │ ├── Metro.pdf.svn-base │ │ │ │ ├── about.txt.svn-base │ │ │ │ ├── Metro.h.svn-base │ │ │ │ ├── keywords.txt.svn-base │ │ │ │ └── Metro.cpp.svn-base │ │ │ └── entries │ │ ├── Metro.pdf │ │ ├── about.txt │ │ ├── examples │ │ │ ├── blinking │ │ │ │ ├── .svn │ │ │ │ │ ├── prop-base │ │ │ │ │ │ └── blinking.pde.svn-base │ │ │ │ │ ├── entries │ │ │ │ │ └── text-base │ │ │ │ │ │ └── blinking.pde.svn-base │ │ │ │ └── blinking.pde │ │ │ ├── serialInterval │ │ │ │ ├── .svn │ │ │ │ │ ├── prop-base │ │ │ │ │ │ └── serialInterval.pde.svn-base │ │ │ │ │ ├── entries │ │ │ │ │ └── text-base │ │ │ │ │ │ └── serialInterval.pde.svn-base │ │ │ │ └── serialInterval.pde │ │ │ ├── .svn │ │ │ │ ├── prop-base │ │ │ │ │ └── blinking_2_instances.zip.svn-base │ │ │ │ ├── text-base │ │ │ │ │ └── blinking_2_instances.zip.svn-base │ │ │ │ └── entries │ │ │ ├── blinking_2_instances.zip │ │ │ └── blinking_2_instances │ │ │ │ ├── .svn │ │ │ │ ├── entries │ │ │ │ └── text-base │ │ │ │ │ └── blinking_2_instances.pde.svn-base │ │ │ │ └── blinking_2_instances.pde │ │ ├── src │ │ │ ├── Metro.h │ │ │ └── Metro.cpp │ │ └── keywords.txt │ ├── HSB_Color │ │ ├── HSBColor.h │ │ ├── README.md │ │ └── HSBColor.cpp │ ├── readme.txt │ └── ESPHelper_Utils │ │ └── ESPHelper_base.h ├── platformio.ini └── src │ └── RGB_WS2812_Light.ino ├── README.md ├── LED_bedsideTable.svg └── LED_bedsideTable.lbrn /RGB_WS2812_Light/lib/lightLib/myTypes.c: -------------------------------------------------------------------------------- 1 | // #include "myTypes.h" 2 | 3 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/prop-base/Metro.h.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/prop-base/Metro.cpp.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/prop-base/about.txt.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/prop-base/keywords.txt.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/Metro.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/Metro.pdf -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/about.txt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/about.txt -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking/.svn/prop-base/blinking.pde.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/serialInterval/.svn/prop-base/serialInterval.pde.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | END 6 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # smartTable 2 | files for my smart bedside table project. This is posted for public use but is not actively being updated or bug-fixed 3 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/.svn/prop-base/blinking_2_instances.zip.svn-base: -------------------------------------------------------------------------------- 1 | K 13 2 | svn:mime-type 3 | V 24 4 | application/octet-stream 5 | END 6 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/text-base/Metro.pdf.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/.svn/text-base/Metro.pdf.svn-base -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/text-base/about.txt.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/.svn/text-base/about.txt.svn-base -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking_2_instances.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/examples/blinking_2_instances.zip -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/prop-base/Metro.pdf.svn-base: -------------------------------------------------------------------------------- 1 | K 14 2 | svn:executable 3 | V 0 4 | 5 | K 13 6 | svn:mime-type 7 | V 24 8 | application/octet-stream 9 | END 10 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/.svn/text-base/blinking_2_instances.zip.svn-base: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ItKindaWorks/smartTable/master/RGB_WS2812_Light/lib/Metro/examples/.svn/text-base/blinking_2_instances.zip.svn-base -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/text-base/Metro.h.svn-base: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef Metro_h 4 | #define Metro_h 5 | 6 | #include 7 | 8 | class Metro 9 | { 10 | 11 | public: 12 | Metro(unsigned long interval_millis); 13 | Metro(unsigned long interval_millis, uint8_t autoreset); 14 | void interval(unsigned long interval_millis); 15 | char check(); 16 | void reset(); 17 | 18 | private: 19 | uint8_t autoreset; 20 | unsigned long previous_millis, interval_millis; 21 | 22 | }; 23 | 24 | #endif 25 | 26 | 27 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/src/Metro.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | #ifndef Metro_h 4 | #define Metro_h 5 | 6 | #include 7 | 8 | class Metro 9 | { 10 | 11 | public: 12 | Metro(unsigned long interval_millis); 13 | Metro(unsigned long interval_millis, uint8_t autoreset); 14 | void interval(unsigned long interval_millis); 15 | unsigned long checkMillis(); 16 | char check(); 17 | void reset(); 18 | 19 | private: 20 | uint8_t autoreset; 21 | unsigned long previous_millis, interval_millis; 22 | 23 | }; 24 | 25 | #endif 26 | 27 | 28 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Test 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Metro KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | check KEYWORD2 16 | interval KEYWORD2 17 | 18 | ####################################### 19 | # Instances (KEYWORD2) 20 | ####################################### 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | 26 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | file://localhost/Users/cromer/Documents/SVN/test/Arduino/libraries/Metro/examples/blinking 6 | file://localhost/Users/cromer/Documents/SVN/test 7 | 8 | 9 | 10 | 2012-12-13T10:12:28.693182Z 11 | 1 12 | cromer 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f0375619-656b-4b81-92d1-34963d12e3ad 28 | 29 | blinking.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2012-12-13T10:16:05.000000Z 36 | ac9d1a0c28f8d5cce96f5960afc3c177 37 | 2012-12-13T10:12:28.693182Z 38 | 1 39 | cromer 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 858 62 | 63 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/text-base/keywords.txt.svn-base: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For Test 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | Metro KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions (KEYWORD2) 13 | ####################################### 14 | 15 | check KEYWORD2 16 | interval KEYWORD2 17 | 18 | ####################################### 19 | # Instances (KEYWORD2) 20 | ####################################### 21 | 22 | ####################################### 23 | # Constants (LITERAL1) 24 | ####################################### 25 | 26 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/serialInterval/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | file://localhost/Users/cromer/Documents/SVN/test/Arduino/libraries/Metro/examples/serialInterval 6 | file://localhost/Users/cromer/Documents/SVN/test 7 | 8 | 9 | 10 | 2012-12-13T10:12:28.693182Z 11 | 1 12 | cromer 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f0375619-656b-4b81-92d1-34963d12e3ad 28 | 29 | serialInterval.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2012-12-13T10:16:05.000000Z 36 | 2451aaf3c262d3ddebf7f8274db473ef 37 | 2012-12-13T10:12:28.693182Z 38 | 1 39 | cromer 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 646 62 | 63 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking_2_instances/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | file://localhost/Users/cromer/Documents/SVN/test/Arduino/libraries/Metro/examples/blinking_2_instances 6 | file://localhost/Users/cromer/Documents/SVN/test 7 | 8 | 9 | 10 | 2012-12-13T10:12:28.693182Z 11 | 1 12 | cromer 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f0375619-656b-4b81-92d1-34963d12e3ad 28 | 29 | blinking_2_instances.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2012-12-13T10:16:05.000000Z 36 | 1e087c88cd4fbeaa3b01ed60f02c2c46 37 | 2012-12-13T10:12:28.693182Z 38 | 1 39 | cromer 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 1078 62 | 63 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/platformio.ini: -------------------------------------------------------------------------------- 1 | ; PlatformIO Project Configuration File 2 | ; 3 | ; Build options: build flags, source filter 4 | ; Upload options: custom upload port, speed and extra flags 5 | ; Library options: dependencies, extra library storages 6 | ; Advanced options: extra scripting 7 | ; 8 | ; Please visit documentation for the other options and examples 9 | ; http://docs.platformio.org/page/projectconf.html 10 | 11 | [env:d1_mini] 12 | board = d1_mini 13 | framework = arduino 14 | platform = https://github.com/platformio/platform-espressif8266.git 15 | lib_ldf_mode = deep+ 16 | lib_deps = 17 | PubSubClient 18 | http://github.com/ItKindaWorks/ESPHelper.git 19 | ArduinoJson@6.10.0 20 | FastLED 21 | 22 | monitor_speed = 115200 23 | upload_port = /dev/cu.usbserial-1440 24 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/serialInterval/serialInterval.pde: -------------------------------------------------------------------------------- 1 | // This example sends a Serial message every 250 milliseconds 2 | 3 | #include // Include the Metro library 4 | 5 | Metro serialMetro = Metro(250); // Instantiate an instance 6 | 7 | void setup() { 8 | Serial.begin(115200); // Start the Serial communication 9 | } 10 | 11 | void loop() { 12 | 13 | if (serialMetro.check() == 1) { // check if the metro has passed it's interval . 14 | // Output all the analog readings seperated by a space character 15 | for (int i = 0; i < 6; i++ ) { 16 | Serial.print (analogRead( i) ); 17 | Serial.print(32,BYTE); 18 | } 19 | // Terminate message with a linefeed and a carriage return 20 | Serial.print(13,BYTE); 21 | Serial.print(10,BYTE); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/serialInterval/.svn/text-base/serialInterval.pde.svn-base: -------------------------------------------------------------------------------- 1 | // This example sends a Serial message every 250 milliseconds 2 | 3 | #include // Include the Metro library 4 | 5 | Metro serialMetro = Metro(250); // Instantiate an instance 6 | 7 | void setup() { 8 | Serial.begin(115200); // Start the Serial communication 9 | } 10 | 11 | void loop() { 12 | 13 | if (serialMetro.check() == 1) { // check if the metro has passed it's interval . 14 | // Output all the analog readings seperated by a space character 15 | for (int i = 0; i < 6; i++ ) { 16 | Serial.print (analogRead( i) ); 17 | Serial.print(32,BYTE); 18 | } 19 | // Terminate message with a linefeed and a carriage return 20 | Serial.print(13,BYTE); 21 | Serial.print(10,BYTE); 22 | } 23 | } 24 | 25 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | file://localhost/Users/cromer/Documents/SVN/test/Arduino/libraries/Metro/examples 6 | file://localhost/Users/cromer/Documents/SVN/test 7 | 8 | 9 | 10 | 2012-12-13T10:12:28.693182Z 11 | 1 12 | cromer 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f0375619-656b-4b81-92d1-34963d12e3ad 28 | 29 | serialInterval 30 | dir 31 | 32 | blinking_2_instances 33 | dir 34 | 35 | blinking_2_instances.zip 36 | file 37 | 38 | 39 | 40 | 41 | 2012-12-13T10:16:05.000000Z 42 | fbea96ad11d4822b30d8f570fa6e23ab 43 | 2012-12-13T10:12:28.693182Z 44 | 1 45 | cromer 46 | has-props 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 810 68 | 69 | blinking 70 | dir 71 | 72 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/HSB_Color/HSBColor.h: -------------------------------------------------------------------------------- 1 | /* 2 | HSB Color, 3 | Library that converts HSB color values to RGB colors. 4 | Created by Julio Terra, June 4, 2011. 5 | 6 | Header File Name: HSBColor.h 7 | Implementation File Name: HSBColor.h 8 | 9 | */ 10 | 11 | #ifndef HSBColor_h 12 | #define HSBColor_h 13 | 14 | #if defined(ARDUINO) && ARDUINO >= 100 15 | #include "Arduino.h" 16 | #else 17 | #include "WProgram.h" 18 | #endif 19 | 20 | // #define H2R_MAX_RGB_val 1023.0 21 | 22 | #define H2R_MAX_RGB_val 255.0 23 | 24 | 25 | 26 | void setMaxRGB(int newMax); 27 | 28 | void H2R_HSBtoRGB(int, int, int, int*); 29 | void H2R_HSBtoRGBfloat(float, float, float, int*); 30 | 31 | #endif 32 | 33 | /* This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 34 | To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send 35 | a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 36 | */ 37 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/readme.txt: -------------------------------------------------------------------------------- 1 | 2 | This directory is intended for the project specific (private) libraries. 3 | PlatformIO will compile them to static libraries and link to executable file. 4 | 5 | The source code of each library should be placed in separate directory, like 6 | "lib/private_lib/[here are source files]". 7 | 8 | For example, see how can be organized `Foo` and `Bar` libraries: 9 | 10 | |--lib 11 | | |--Bar 12 | | | |--docs 13 | | | |--examples 14 | | | |--src 15 | | | |- Bar.c 16 | | | |- Bar.h 17 | | |--Foo 18 | | | |- Foo.c 19 | | | |- Foo.h 20 | | |- readme.txt --> THIS FILE 21 | |- platformio.ini 22 | |--src 23 | |- main.c 24 | 25 | Then in `src/main.c` you should use: 26 | 27 | #include 28 | #include 29 | 30 | // rest H/C/CPP code 31 | 32 | PlatformIO will find your libraries automatically, configure preprocessor's 33 | include paths and build them. 34 | 35 | More information about PlatformIO Library Dependency Finder 36 | - http://docs.platformio.org/page/librarymanager/ldf.html 37 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking/blinking.pde: -------------------------------------------------------------------------------- 1 | /* 2 | This code will blink an LED attached to pin 13 on and off. 3 | It will stay on for 0.25 seconds. 4 | It will stay off for 1 second. 5 | */ 6 | #include //Include Metro library 7 | #define LED 13 // Define the led's pin 8 | 9 | //Create a variable to hold theled's current state 10 | int state = HIGH; 11 | 12 | // Instanciate a metro object and set the interval to 250 milliseconds (0.25 seconds). 13 | Metro ledMetro = Metro(250); 14 | 15 | void setup() 16 | { 17 | pinMode(LED,OUTPUT); 18 | digitalWrite(LED,state); 19 | } 20 | 21 | void loop() 22 | { 23 | 24 | if (ledMetro.check() == 1) { // check if the metro has passed its interval . 25 | if (state==HIGH) { 26 | state=LOW; 27 | ledMetro.interval(250); // if the pin is HIGH, set the interval to 0.25 seconds. 28 | } 29 | else { 30 | ledMetro.interval(1000); // if the pin is LOW, set the interval to 1 second. 31 | state=HIGH; 32 | } 33 | digitalWrite(LED,state); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking/.svn/text-base/blinking.pde.svn-base: -------------------------------------------------------------------------------- 1 | /* 2 | This code will blink an LED attached to pin 13 on and off. 3 | It will stay on for 0.25 seconds. 4 | It will stay off for 1 second. 5 | */ 6 | #include //Include Metro library 7 | #define LED 13 // Define the led's pin 8 | 9 | //Create a variable to hold theled's current state 10 | int state = HIGH; 11 | 12 | // Instanciate a metro object and set the interval to 250 milliseconds (0.25 seconds). 13 | Metro ledMetro = Metro(250); 14 | 15 | void setup() 16 | { 17 | pinMode(LED,OUTPUT); 18 | digitalWrite(LED,state); 19 | } 20 | 21 | void loop() 22 | { 23 | 24 | if (ledMetro.check() == 1) { // check if the metro has passed its interval . 25 | if (state==HIGH) { 26 | state=LOW; 27 | ledMetro.interval(250); // if the pin is HIGH, set the interval to 0.25 seconds. 28 | } 29 | else { 30 | ledMetro.interval(1000); // if the pin is LOW, set the interval to 1 second. 31 | state=HIGH; 32 | } 33 | digitalWrite(LED,state); 34 | } 35 | } 36 | 37 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking_2_instances/blinking_2_instances.pde: -------------------------------------------------------------------------------- 1 | // This code will blink output 13 every 250 ms 2 | // abd will blink output 9 every 125 ms 3 | 4 | 5 | #include // Include Metro library 6 | #define LED0 13 // Define a LED pin 7 | #define LED1 9 // Define another LED pin 8 | 9 | // Create variables to hold the LED states 10 | int state0 = HIGH; 11 | int state1 = HIGH; 12 | 13 | // Instantiate a metro object and set the interval to 250 milliseconds (0.25 seconds). 14 | Metro metro0 = Metro(500); 15 | 16 | // Instantiate another metro object and set the interval to 125 milliseconds (0.125 seconds). 17 | Metro metro1 = Metro(125); 18 | 19 | void setup() 20 | { 21 | pinMode(LED0,OUTPUT); 22 | digitalWrite(LED0,state0); 23 | 24 | pinMode(LED1,OUTPUT); 25 | digitalWrite(LED1,state1); 26 | 27 | } 28 | 29 | void loop() 30 | { 31 | 32 | if (metro0.check() == 1) { // check if the metro has passed its interval . 33 | if (state0==HIGH) { 34 | state0=LOW; 35 | } else { 36 | state0=HIGH; 37 | } 38 | digitalWrite(LED0,state0); 39 | } 40 | 41 | if (metro1.check() == 1) { // check if the metro has passed its interval . 42 | if (state1==HIGH) { 43 | state1=LOW; 44 | } else { 45 | state1=HIGH; 46 | } 47 | digitalWrite(LED1,state1); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/examples/blinking_2_instances/.svn/text-base/blinking_2_instances.pde.svn-base: -------------------------------------------------------------------------------- 1 | // This code will blink output 13 every 250 ms 2 | // abd will blink output 9 every 125 ms 3 | 4 | 5 | #include // Include Metro library 6 | #define LED0 13 // Define a LED pin 7 | #define LED1 9 // Define another LED pin 8 | 9 | // Create variables to hold the LED states 10 | int state0 = HIGH; 11 | int state1 = HIGH; 12 | 13 | // Instantiate a metro object and set the interval to 250 milliseconds (0.25 seconds). 14 | Metro metro0 = Metro(500); 15 | 16 | // Instantiate another metro object and set the interval to 125 milliseconds (0.125 seconds). 17 | Metro metro1 = Metro(125); 18 | 19 | void setup() 20 | { 21 | pinMode(LED0,OUTPUT); 22 | digitalWrite(LED0,state0); 23 | 24 | pinMode(LED1,OUTPUT); 25 | digitalWrite(LED1,state1); 26 | 27 | } 28 | 29 | void loop() 30 | { 31 | 32 | if (metro0.check() == 1) { // check if the metro has passed its interval . 33 | if (state0==HIGH) { 34 | state0=LOW; 35 | } else { 36 | state0=HIGH; 37 | } 38 | digitalWrite(LED0,state0); 39 | } 40 | 41 | if (metro1.check() == 1) { // check if the metro has passed its interval . 42 | if (state1==HIGH) { 43 | state1=LOW; 44 | } else { 45 | state1=HIGH; 46 | } 47 | digitalWrite(LED1,state1); 48 | } 49 | 50 | 51 | } 52 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/HSB_Color/README.md: -------------------------------------------------------------------------------- 1 | HSB_Color 2 | ========= 3 | 4 | The HSB Color library converts HSB colors values to RGB color values. It was designed to drive rgb leds using hue, saturation and brightness values. 5 | 6 | Installing the Library 7 | ---------------------- 8 | 9 | * Download the library zip file from Github 10 | * Unzip the downloaded file 11 | * Copy HSB_Color folder into Arduino libraries folder 12 | * Launch (or restart) the Arduino IDE 13 | 14 | Using the Library 15 | ----------------- 16 | 17 | The HSB library provides two different methods that convert HSB to RGB values. They both accept the 4 parameters, three number values and a pointer to an integer array. They differ in that one of them accepts three integers, while the other accepts three float. 18 | 19 | The RGB values are saved into the integer array that is passed as the fourth parameter of each method. RGB values will range between 0 and 255. Make sure the array can accommodate three integers, otherwise the sketch won't work (though it may compile). 20 | 21 | **Integer Method** 22 | ``` 23 | void H2R_HSBtoRGB(int hue, int saturation, int brightness, int* rbg_array); 24 | ``` 25 | Value Range: 26 | * hue: 0 - 359 27 | * saturation: 0 - 99 28 | * brightness: 0 - 99 29 | 30 | **Float Method** 31 | ``` 32 | void H2R_HSBtoRGBfloat(float hue, float saturation, float brightness, int* rbg_array); 33 | ``` 34 | Float Value Range: 35 | * hue: 0.0 - 1.0 36 | * saturation: 0.0 - 1.0 37 | * brightness: 0.0 - 1.0 38 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/text-base/Metro.cpp.svn-base: -------------------------------------------------------------------------------- 1 | 2 | #if defined(ARDUINO) && ARDUINO >= 100 3 | #include "Arduino.h" 4 | #else 5 | #include "WProgram.h" 6 | #endif 7 | #include "Metro.h" 8 | 9 | 10 | Metro::Metro(unsigned long interval_millis) 11 | { 12 | this->autoreset = 0; 13 | interval(interval_millis); 14 | reset(); 15 | } 16 | 17 | // New creator so I can use either the original check behavior or benjamin.soelberg's 18 | // suggested one (see below). 19 | // autoreset = 0 is benjamin.soelberg's check behavior 20 | // autoreset != 0 is the original behavior 21 | 22 | Metro::Metro(unsigned long interval_millis, uint8_t autoreset) 23 | { 24 | this->autoreset = autoreset; // Fix by Paul Bouchier 25 | interval(interval_millis); 26 | reset(); 27 | } 28 | 29 | void Metro::interval(unsigned long interval_millis) 30 | { 31 | this->interval_millis = interval_millis; 32 | } 33 | 34 | // Benjamin.soelberg's check behavior: 35 | // When a check is true, add the interval to the internal counter. 36 | // This should guarantee a better overall stability. 37 | 38 | // Original check behavior: 39 | // When a check is true, add the interval to the current millis() counter. 40 | // This method can add a certain offset over time. 41 | 42 | char Metro::check() 43 | { 44 | if (millis() - this->previous_millis >= this->interval_millis) { 45 | // As suggested by benjamin.soelberg@gmail.com, the following line 46 | // this->previous_millis = millis(); 47 | // was changed to 48 | // this->previous_millis += this->interval_millis; 49 | 50 | // If the interval is set to 0 we revert to the original behavior 51 | if (this->interval_millis <= 0 || this->autoreset ) { 52 | this->previous_millis = millis(); 53 | } else { 54 | this->previous_millis += this->interval_millis; 55 | } 56 | 57 | return 1; 58 | } 59 | 60 | 61 | 62 | return 0; 63 | 64 | } 65 | 66 | void Metro::reset() 67 | { 68 | 69 | this->previous_millis = millis(); 70 | 71 | } 72 | 73 | 74 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 1 5 | file://localhost/Users/cromer/Documents/SVN/test/Arduino/libraries/Metro 6 | file://localhost/Users/cromer/Documents/SVN/test 7 | 8 | 9 | 10 | 2012-12-13T10:12:28.693182Z 11 | 1 12 | cromer 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | f0375619-656b-4b81-92d1-34963d12e3ad 28 | 29 | keywords.txt 30 | file 31 | 32 | 33 | 34 | 35 | 2012-12-13T10:16:05.000000Z 36 | 0239e718771cc2fd1f7173b42dc92c7c 37 | 2012-12-13T10:12:28.693182Z 38 | 1 39 | cromer 40 | has-props 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 590 62 | 63 | Metro.cpp 64 | file 65 | 66 | 67 | 68 | 69 | 2012-12-13T10:16:05.000000Z 70 | f7b99ff4218df4e5289956fb1ad08f45 71 | 2012-12-13T10:12:28.693182Z 72 | 1 73 | cromer 74 | has-props 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1649 96 | 97 | about.txt 98 | file 99 | 100 | 101 | 102 | 103 | 2012-12-13T10:16:05.000000Z 104 | be1d625a9c642abafd102cfc117dfb2d 105 | 2012-12-13T10:12:28.693182Z 106 | 1 107 | cromer 108 | has-props 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 155 130 | 131 | Metro.h 132 | file 133 | 134 | 135 | 136 | 137 | 2012-12-13T10:16:05.000000Z 138 | cbcec556ce52b8385f3265f25f024512 139 | 2012-12-13T10:12:28.693182Z 140 | 1 141 | cromer 142 | has-props 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 357 164 | 165 | examples 166 | dir 167 | 168 | Metro.pdf 169 | file 170 | 171 | 172 | 173 | 174 | 2012-12-13T10:16:05.000000Z 175 | 82356a726ad8d73c43732b8e115e21e9 176 | 2012-12-13T10:12:28.693182Z 177 | 1 178 | cromer 179 | has-props 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 80306 201 | 202 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/Metro/src/Metro.cpp: -------------------------------------------------------------------------------- 1 | 2 | #if defined(ARDUINO) && ARDUINO >= 100 3 | #include "Arduino.h" 4 | #else 5 | #include "WProgram.h" 6 | #endif 7 | #include "Metro.h" 8 | 9 | 10 | Metro::Metro(unsigned long interval_millis) 11 | { 12 | this->autoreset = 0; 13 | interval(interval_millis); 14 | reset(); 15 | } 16 | 17 | // New creator so I can use either the original check behavior or benjamin.soelberg's 18 | // suggested one (see below). 19 | // autoreset = 0 is benjamin.soelberg's check behavior 20 | // autoreset != 0 is the original behavior 21 | 22 | Metro::Metro(unsigned long interval_millis, uint8_t autoreset) 23 | { 24 | this->autoreset = autoreset; // Fix by Paul Bouchier 25 | interval(interval_millis); 26 | reset(); 27 | } 28 | 29 | void Metro::interval(unsigned long interval_millis) 30 | { 31 | this->interval_millis = interval_millis; 32 | } 33 | 34 | // Benjamin.soelberg's check behavior: 35 | // When a check is true, add the interval to the internal counter. 36 | // This should guarantee a better overall stability. 37 | 38 | // Original check behavior: 39 | // When a check is true, add the interval to the current millis() counter. 40 | // This method can add a certain offset over time. 41 | 42 | char Metro::check() 43 | { 44 | if (millis() - this->previous_millis >= this->interval_millis) { 45 | // As suggested by benjamin.soelberg@gmail.com, the following line 46 | // this->previous_millis = millis(); 47 | // was changed to 48 | // this->previous_millis += this->interval_millis; 49 | 50 | // If the interval is set to 0 we revert to the original behavior 51 | if (this->interval_millis <= 0 || this->autoreset ) { 52 | this->previous_millis = millis(); 53 | } else { 54 | this->previous_millis += this->interval_millis; 55 | } 56 | 57 | return 1; 58 | } 59 | 60 | 61 | 62 | return 0; 63 | 64 | } 65 | 66 | unsigned long Metro::checkMillis(){ 67 | unsigned long startTime = this->previous_millis; 68 | unsigned long endTime = this->previous_millis + this->interval_millis; 69 | unsigned long currentTime = millis(); 70 | unsigned long timeRemaining = endTime - currentTime; 71 | 72 | return timeRemaining; 73 | 74 | } 75 | 76 | void Metro::reset() 77 | { 78 | 79 | this->previous_millis = millis(); 80 | 81 | } 82 | 83 | 84 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/HSB_Color/HSBColor.cpp: -------------------------------------------------------------------------------- 1 | #include "HSBColor.h" 2 | 3 | int maxRGB = H2R_MAX_RGB_val; 4 | 5 | /* HSB to RGB conversion function 6 | INPUT PARAMETERS: Hue values should range from 0 to 360, Saturation and Brightness values should range from 0 to 100 7 | Colors pointer should resolve to an array with 3 elements 8 | RGB values are passed back using via the array. Each value will range between 0 and 255 9 | */ 10 | void H2R_HSBtoRGB(int hue, int sat, int bright, int* colors) { 11 | 12 | // constrain all input variables to expected range 13 | hue = constrain(hue, 0, 360); 14 | sat = constrain(sat, 0, 100); 15 | bright = constrain(bright, 0, 100); 16 | 17 | // define maximum value for RGB array elements 18 | float max_rgb_val = maxRGB; 19 | 20 | // convert saturation and brightness value to decimals and init r, g, b variables 21 | float sat_f = float(sat) / 100.0; 22 | float bright_f = float(bright) / 100.0; 23 | int r, g, b; 24 | 25 | // If brightness is 0 then color is black (achromatic) 26 | // therefore, R, G and B values will all equal to 0 27 | if (bright <= 0) { 28 | colors[0] = 0; 29 | colors[1] = 0; 30 | colors[2] = 0; 31 | } 32 | 33 | // If saturation is 0 then color is gray (achromatic) 34 | // therefore, R, G and B values will all equal the current brightness 35 | if (sat <= 0) { 36 | colors[0] = bright_f * max_rgb_val; 37 | colors[1] = bright_f * max_rgb_val; 38 | colors[2] = bright_f * max_rgb_val; 39 | } 40 | 41 | // if saturation and brightness are greater than 0 then calculate 42 | // R, G and B values based on the current hue and brightness 43 | else { 44 | 45 | if (hue >= 0 && hue < 120) { 46 | float hue_primary = 1.0 - (float(hue) / 120.0); 47 | float hue_secondary = float(hue) / 120.0; 48 | float sat_primary = (1.0 - hue_primary) * (1.0 - sat_f); 49 | float sat_secondary = (1.0 - hue_secondary) * (1.0 - sat_f); 50 | float sat_tertiary = 1.0 - sat_f; 51 | r = (bright_f * max_rgb_val) * (hue_primary + sat_primary); 52 | g = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary); 53 | b = (bright_f * max_rgb_val) * sat_tertiary; 54 | } 55 | 56 | else if (hue >= 120 && hue < 240) { 57 | float hue_primary = 1.0 - ((float(hue)-120.0) / 120.0); 58 | float hue_secondary = (float(hue)-120.0) / 120.0; 59 | float sat_primary = (1.0 - hue_primary) * (1.0 - sat_f); 60 | float sat_secondary = (1.0 - hue_secondary) * (1.0 - sat_f); 61 | float sat_tertiary = 1.0 - sat_f; 62 | r = (bright_f * max_rgb_val) * sat_tertiary; 63 | g = (bright_f * max_rgb_val) * (hue_primary + sat_primary); 64 | b = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary); 65 | } 66 | 67 | else if (hue >= 240 && hue <= 360) { 68 | float hue_primary = 1.0 - ((float(hue)-240.0) / 120.0); 69 | float hue_secondary = (float(hue)-240.0) / 120.0; 70 | float sat_primary = (1.0 - hue_primary) * (1.0 - sat_f); 71 | float sat_secondary = (1.0 - hue_secondary) * (1.0 - sat_f); 72 | float sat_tertiary = 1.0 - sat_f; 73 | r = (bright_f * max_rgb_val) * (hue_secondary + sat_secondary); 74 | g = (bright_f * max_rgb_val) * sat_tertiary; 75 | b = (bright_f * max_rgb_val) * (hue_primary + sat_primary); 76 | } 77 | 78 | colors[0]=r; 79 | colors[1]=g; 80 | colors[2]=b; 81 | 82 | } 83 | } 84 | 85 | void H2R_HSBtoRGBfloat(float hue, float sat, float bright, int* colors) { 86 | if (hue > 1) hue = 1.0; 87 | if (sat > 1) sat = 1.0; 88 | if (bright > 1) bright = 1.0; 89 | H2R_HSBtoRGB(hue*360.0, sat*100.0, bright*100.0, colors); 90 | } 91 | 92 | void setMaxRGB(int newMax){ 93 | maxRGB = newMax; 94 | } 95 | 96 | 97 | /* This work is licensed under the Creative Commons Attribution-ShareAlike 3.0 Unported License. 98 | To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/ or send 99 | a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA. 100 | */ -------------------------------------------------------------------------------- /LED_bedsideTable.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 157 | 158 | 159 | 160 | 162 | 163 | 164 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/ESPHelper_Utils/ESPHelper_base.h: -------------------------------------------------------------------------------- 1 | #ifndef ESPHELPER_BASE 2 | #define ESPHELPER_BASE 3 | 4 | #include "ESPHelper.h" 5 | #include 6 | #include "ESPHelperFS.h" 7 | #include "ESPHelperWebConfig.h" 8 | 9 | //setup macros for time 10 | #define SECOND 1000L 11 | #define MINUTE SECOND * 60L 12 | #define HOUR MINUTE * 60L 13 | 14 | #define NETWORK_HOSTNAME "New-ESP" 15 | const char* HOSTNAME = NETWORK_HOSTNAME; 16 | 17 | bool loadConfig(); 18 | void loadKey(const char* keyName, const char* filename, char* data, const uint16_t dataSize, const char* defaultData); 19 | void loadKey(const char* keyName, const char* filename, double *data); 20 | void loadKey(const char* keyName, const char* filename, int32_t *data); 21 | void addKey(const char* key, char* buf, const char *file); 22 | void startWifi(bool loadCfg); 23 | void checkForWifiTimeout(); 24 | void checkFS(); 25 | 26 | bool wifiTimeout = false; 27 | 28 | //timer that signals the ESP to restart if in broadcast mode for too long 29 | //(generally because it couldnt connect to wifi) 30 | Metro restartTimer = Metro(3 * MINUTE); 31 | 32 | //wifi connect timeout timer (drops into broadcast mode when triggered) 33 | Metro connectTimeout = Metro(20 * SECOND); 34 | 35 | 36 | int progModeCount = 0; 37 | 38 | 39 | netInfo config; 40 | ESPHelper myESP; 41 | 42 | ESP8266WebServer server(80); 43 | ESPHelperWebConfig configPage(&server, "/config"); 44 | const char* configFileString = "/networkConfig.json"; 45 | 46 | const char* broadcastSSID = NETWORK_HOSTNAME "-Hotspot"; 47 | const char* broadcastPASS = ""; 48 | IPAddress broadcastIP = {192, 168, 1, 1}; 49 | 50 | extern bool justReconnected; 51 | 52 | //ESPHelper 53 | netInfo defaultNet = { .mqttHost = "", //can be blank if not using MQTT 54 | .mqttUser = "", //can be blank 55 | .mqttPass = "", //can be blank 56 | .mqttPort = 1883, //default port for MQTT is 1883 - only change if needed. 57 | .ssid = "", 58 | .pass = ""}; 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | //attempt to load a network configuration from the filesystem 67 | bool loadConfig(){ 68 | //check for a good config file and start ESPHelper with the file stored on the ESP 69 | if(ESPHelperFS::begin()){ 70 | 71 | if(ESPHelperFS::validateConfig(configFileString) == GOOD_CONFIG){ 72 | return true; 73 | } 74 | 75 | //if no good config can be loaded (no file/corruption/etc.) then 76 | //attempt to generate a new config and restart the module 77 | else{ 78 | 79 | delay(10); 80 | defaultNet.hostname = HOSTNAME; 81 | ESPHelperFS::createConfig(&defaultNet, configFileString); 82 | ESPHelperFS::end(); 83 | ESP.restart(); 84 | 85 | //note this will probably never end up returning because of the restart call 86 | //but gotta have it here because we always need a path to return 87 | return false; 88 | } 89 | } 90 | 91 | //if the filesystem cannot be started, just fail over to the 92 | //built in network config hardcoded in here 93 | else{ 94 | return false; 95 | } 96 | 97 | return false; 98 | } 99 | void manageESPHelper(int wifiStatus){ 100 | 101 | //if the system has been running for a long time in broadcast mode, restart it 102 | if(wifiStatus == BROADCAST && restartTimer.check()){ 103 | // ESP.restart(); 104 | myESP.disableBroadcast(); 105 | 106 | //after first failure change the restart timer to a small time because 107 | //we probably dont need all that extra time after the first failure 108 | //(ie the first time is possibly because we want to program it but after that 109 | //its probably because of crappy wifi) 110 | 111 | restartTimer.interval(10*SECOND); 112 | restartTimer.reset(); 113 | 114 | connectTimeout.reset(); 115 | myESP.OTA_enable(); 116 | wifiTimeout = false; 117 | justReconnected = true; //reset reconnect val to true for when the ESP does reconnect 118 | Serial.println("Config Mode Timeout. Restarting Normal Station Mode Through ESPHelper"); 119 | return; 120 | } 121 | 122 | //if the unit is broadcasting or connected to wifi then reset the timeout vars 123 | if(wifiStatus == BROADCAST || wifiStatus >= WIFI_ONLY){ 124 | connectTimeout.reset(); 125 | wifiTimeout = false; 126 | } 127 | //otherwise check for a timeout condition and handle setting up broadcast 128 | else if(wifiStatus < WIFI_ONLY){ 129 | checkForWifiTimeout(); 130 | } 131 | 132 | //handle saving a new network config 133 | if(configPage.handle()){ 134 | 135 | myESP.saveConfigFile(configPage.getConfig(), configFileString); 136 | delay(500); 137 | ESP.restart(); 138 | } 139 | } 140 | 141 | //function that checks for no network connection for a period of time 142 | //and starting up AP mode when that time has elapsed 143 | void checkForWifiTimeout(){ 144 | if(connectTimeout.check() && !wifiTimeout){ 145 | 146 | restartTimer.reset(); 147 | wifiTimeout = true; 148 | myESP.broadcastMode(broadcastSSID, broadcastPASS, broadcastIP); 149 | myESP.OTA_setPassword(config.otaPassword); 150 | myESP.OTA_setHostnameWithVersion(config.hostname); 151 | myESP.OTA_enable(); 152 | 153 | Serial.printf("\n\n\ 154 | Could not connect to network.\n\ 155 | Broadcasting our own at %s.\n\ 156 | Connect to network and go to 192.168.1.1/config to setup network settings\n",broadcastSSID); 157 | } 158 | } 159 | 160 | 161 | void startWifi(bool loadCfg){ 162 | static bool cfgLoaded = false; 163 | if(loadCfg){ 164 | cfgLoaded = loadConfig(); 165 | // loadOtherCfg(); 166 | } 167 | 168 | if(cfgLoaded){myESP.begin(configFileString);} 169 | else{myESP.begin(&defaultNet);} 170 | 171 | config = myESP.getNetInfo(); 172 | 173 | //setup other ESPHelper info and enable OTA updates 174 | myESP.setHopping(false); 175 | // myESP.enableHeartbeat(blinkPin); 176 | myESP.OTA_setPassword(config.otaPassword); 177 | myESP.OTA_setHostnameWithVersion(config.hostname); 178 | myESP.OTA_enable(); 179 | 180 | 181 | 182 | delay(10); 183 | //connect to wifi before proceeding. If cannot connect then switch to ap mode and create a network to config from 184 | while(myESP.loop() < WIFI_ONLY){ 185 | checkForWifiTimeout(); 186 | if(wifiTimeout){return;} 187 | delay(10); 188 | } 189 | 190 | 191 | } 192 | 193 | 194 | void loadKey(const char* keyName, const char* filename, char* data, const uint16_t dataSize, const char* defaultData){ 195 | ESPHelperFS::begin(); 196 | String toLoad = ESPHelperFS::loadKey(keyName, filename); 197 | //could not load (0 length) or good load 198 | if(toLoad.length() == 0){ 199 | ESPHelperFS::addKey(keyName, defaultData , filename); 200 | String(defaultData).toCharArray(data, dataSize); 201 | } 202 | else{ 203 | toLoad.toCharArray(data, dataSize); 204 | } 205 | ESPHelperFS::end(); 206 | } 207 | 208 | 209 | void loadKey(const char* keyName, const char* filename, double *data){ 210 | ESPHelperFS::begin(); 211 | String toLoad = ESPHelperFS::loadKey(keyName, filename); 212 | //could not load (0 length) or good load 213 | if(toLoad.length() == 0){ 214 | ESPHelperFS::addKey(keyName, "0.0" , filename); 215 | *data = 0.0; 216 | } 217 | else{*data = toLoad.toFloat();} 218 | ESPHelperFS::end(); 219 | } 220 | 221 | 222 | void loadKey(const char* keyName, const char* filename, int32_t *data){ 223 | ESPHelperFS::begin(); 224 | String toLoad = ESPHelperFS::loadKey(keyName, filename); 225 | //could not load (0 length) or good load 226 | if(toLoad.length() == 0){ 227 | ESPHelperFS::addKey(keyName, "0" , filename); 228 | *data = 0; 229 | } 230 | else{*data = toLoad.toInt();} 231 | ESPHelperFS::end(); 232 | } 233 | 234 | 235 | void addKey(const char* key, char* buf, const char *file){ 236 | ESPHelperFS::begin(); 237 | ESPHelperFS::addKey(key, buf, file); 238 | ESPHelperFS::end(); 239 | } 240 | 241 | 242 | void checkFS(){ 243 | SPIFFS.begin(); 244 | //if file does not exist then FS is not formatted 245 | if (!SPIFFS.exists("/formatComplete.txt")) { 246 | Serial.println("Please wait 30 secs for SPIFFS to be formatted"); 247 | SPIFFS.format(); 248 | Serial.println("Spiffs formatted"); 249 | 250 | File f = SPIFFS.open("/formatComplete.txt", "w"); 251 | if (!f) {} // failed to open file 252 | else {f.println("Format Complete");} 253 | } 254 | SPIFFS.end(); 255 | } 256 | 257 | #endif 258 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/lib/lightLib/myTypes.h: -------------------------------------------------------------------------------- 1 | #ifndef myTypes_h 2 | #define myTypes_h 3 | 4 | typedef struct lightState{ 5 | //hsv 6 | double hue; 7 | double saturation; 8 | double brightness; 9 | 10 | //rgb 11 | int red; 12 | int green; 13 | int blue; 14 | 15 | //fade rates for each color (all color changes should happen at the same rate so) 16 | //if red needs to move 200 but blue only needs to move 60, they need to fade 17 | //at different rates to get there at the same time 18 | int redRate; 19 | int greenRate; 20 | int blueRate; 21 | 22 | //total period of time that should be spent fading 23 | int fadePeriod; 24 | 25 | //designates what kind of update, RGB, HSV, etc. 26 | int updateType; 27 | }; 28 | 29 | typedef struct timer { 30 | unsigned long previousTime; 31 | int interval; 32 | }; 33 | 34 | // const uint8_t PROGMEM gamma_8b[] = { 35 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 36 | // 0, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 37 | // 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 9, 38 | // 10, 10, 11, 11, 12, 13, 13, 14, 15, 15, 16, 17, 18, 19, 20, 20, 39 | // 21, 22, 23, 24, 25, 26, 27, 29, 30, 31, 32, 33, 35, 36, 37, 38, 40 | // 40, 41, 43, 44, 46, 47, 49, 50, 52, 54, 55, 57, 59, 61, 63, 64, 41 | // 66, 68, 70, 72, 74, 77, 79, 81, 83, 85, 88, 90, 92, 95, 97,100, 42 | // 102,105,107,110,113,115,118,121,124,127,130,133,136,139,142,145, 43 | // 149,152,155,158,162,165,169,172,176,180,183,187,191,195,199,203, 44 | // 207,211,215,219,223,227,232,236,240,245,249,254,258,263,268,273, 45 | // 277,282,287,292,297,302,308,313,318,323,329,334,340,345,351,357, 46 | // 362,368,374,380,386,392,398,404,410,417,423,429,436,442,449,455, 47 | // 462,469,476,483,490,497,504,511,518,525,533,540,548,555,563,571, 48 | // 578,586,594,602,610,618,626,634,643,651,660,668,677,685,694,703, 49 | // 712,721,730,739,748,757,766,776,785,795,804,814,824,833,843,853, 50 | // 863,873,884,894,904,915,925,936,946,957,968,979,990,1001,1012,1023 }; 51 | 52 | // const uint8_t PROGMEM gamma_8b[] = { 53 | // 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 3, 3, 4, 54 | // 4, 5, 5, 6, 6, 7, 8, 8, 9, 10, 11, 11, 12, 13, 14, 15, 55 | // 16, 17, 18, 19, 20, 22, 23, 24, 25, 26, 28, 29, 30, 32, 33, 35, 56 | // 36, 38, 39, 41, 43, 44, 46, 48, 49, 51, 53, 55, 57, 59, 60, 62, 57 | // 64, 66, 69, 71, 73, 75, 77, 79, 82, 84, 86, 88, 91, 93, 96, 98, 58 | // 101,103,106,108,111,114,116,119,122,125,127,130,133,136,139,142, 59 | // 145,148,151,154,157,160,164,167,170,173,177,180,184,187,190,194, 60 | // 197,201,204,208,212,215,219,223,227,230,234,238,242,246,250,254, 61 | // 258,262,266,270,274,278,282,287,291,295,300,304,308,313,317,322, 62 | // 326,331,335,340,345,349,354,359,363,368,373,378,383,388,393,398, 63 | // 403,408,413,418,423,428,434,439,444,449,455,460,465,471,476,482, 64 | // 487,493,498,504,510,515,521,527,533,538,544,550,556,562,568,574, 65 | // 580,586,592,598,604,611,617,623,629,636,642,648,655,661,668,674, 66 | // 681,687,694,700,707,714,720,727,734,741,748,755,761,768,775,782, 67 | // 789,796,804,811,818,825,832,839,847,854,861,869,876,884,891,899, 68 | // 906,914,921,929,937,944,952,960,968,975,983,991,999,1007,1015,1023 }; 69 | 70 | 71 | 72 | // const uint8_t PROGMEM gamma_10b[] = { 73 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 74 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 75 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 76 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 77 | // 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 78 | // 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 79 | // 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 80 | // 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 81 | // 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 82 | // 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 6, 83 | // 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 84 | // 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 9, 85 | // 9, 10, 10, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 11, 12, 12, 86 | // 12, 12, 12, 12, 12, 13, 13, 13, 13, 13, 13, 14, 14, 14, 14, 14, 87 | // 15, 15, 15, 15, 15, 15, 16, 16, 16, 16, 16, 17, 17, 17, 17, 17, 88 | // 18, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 20, 20, 20, 21, 21, 89 | // 21, 21, 22, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 24, 25, 25, 90 | // 25, 25, 26, 26, 26, 26, 27, 27, 27, 27, 28, 28, 28, 29, 29, 29, 91 | // 29, 30, 30, 30, 31, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 92 | // 34, 35, 35, 35, 35, 36, 36, 36, 37, 37, 37, 38, 38, 38, 39, 39, 93 | // 40, 40, 40, 41, 41, 41, 42, 42, 42, 43, 43, 43, 44, 44, 45, 45, 94 | // 45, 46, 46, 46, 47, 47, 48, 48, 48, 49, 49, 50, 50, 50, 51, 51, 95 | // 52, 52, 52, 53, 53, 54, 54, 55, 55, 55, 56, 56, 57, 57, 58, 58, 96 | // 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 63, 64, 64, 65, 65, 97 | // 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 72, 73, 73, 98 | // 74, 74, 75, 75, 76, 76, 77, 77, 78, 79, 79, 80, 80, 81, 81, 82, 99 | // 82, 83, 83, 84, 85, 85, 86, 86, 87, 87, 88, 89, 89, 90, 90, 91, 100 | // 92, 92, 93, 93, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99,100,101, 101 | // 101,102,103,103,104,105,105,106,106,107,108,108,109,110,110,111, 102 | // 112,112,113,114,115,115,116,117,117,118,119,119,120,121,122,122, 103 | // 123,124,124,125,126,127,127,128,129,130,130,131,132,132,133,134, 104 | // 135,136,136,137,138,139,139,140,141,142,143,143,144,145,146,146, 105 | // 147,148,149,150,151,151,152,153,154,155,155,156,157,158,159,160, 106 | // 161,161,162,163,164,165,166,167,167,168,169,170,171,172,173,174, 107 | // 175,175,176,177,178,179,180,181,182,183,184,185,186,186,187,188, 108 | // 189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204, 109 | // 205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220, 110 | // 221,222,223,224,225,226,228,229,230,231,232,233,234,235,236,237, 111 | // 238,239,241,242,243,244,245,246,247,248,249,251,252,253,254,255, 112 | // 256,257,259,260,261,262,263,264,266,267,268,269,270,272,273,274, 113 | // 275,276,278,279,280,281,282,284,285,286,287,289,290,291,292,294, 114 | // 295,296,297,299,300,301,302,304,305,306,308,309,310,311,313,314, 115 | // 315,317,318,319,321,322,323,325,326,327,329,330,331,333,334,336, 116 | // 337,338,340,341,342,344,345,347,348,349,351,352,354,355,356,358, 117 | // 359,361,362,364,365,366,368,369,371,372,374,375,377,378,380,381, 118 | // 383,384,386,387,389,390,392,393,395,396,398,399,401,402,404,405, 119 | // 407,408,410,412,413,415,416,418,419,421,423,424,426,427,429,431, 120 | // 432,434,435,437,439,440,442,444,445,447,448,450,452,453,455,457, 121 | // 458,460,462,463,465,467,468,470,472,474,475,477,479,480,482,484, 122 | // 486,487,489,491,493,494,496,498,500,501,503,505,507,509,510,512, 123 | // 514,516,518,519,521,523,525,527,528,530,532,534,536,538,539,541, 124 | // 543,545,547,549,551,553,554,556,558,560,562,564,566,568,570,572, 125 | // 574,575,577,579,581,583,585,587,589,591,593,595,597,599,601,603, 126 | // 605,607,609,611,613,615,617,619,621,623,625,627,629,631,633,635, 127 | // 637,640,642,644,646,648,650,652,654,656,658,660,663,665,667,669, 128 | // 671,673,675,678,680,682,684,686,688,690,693,695,697,699,701,704, 129 | // 706,708,710,712,715,717,719,721,724,726,728,730,733,735,737,739, 130 | // 742,744,746,749,751,753,755,758,760,762,765,767,769,772,774,776, 131 | // 779,781,783,786,788,790,793,795,798,800,802,805,807,810,812,814, 132 | // 817,819,822,824,827,829,831,834,836,839,841,844,846,849,851,854, 133 | // 856,859,861,864,866,869,871,874,876,879,881,884,887,889,892,894, 134 | // 897,899,902,905,907,910,912,915,918,920,923,925,928,931,933,936, 135 | // 939,941,944,947,949,952,955,957,960,963,965,968,971,973,976,979, 136 | // 982,984,987,990,992,995,998,1001,1004,1006,1009,1012,1015,1017,1020,1023 }; 137 | 138 | // const uint8_t PROGMEM gamma_10b[] = { 139 | // 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 140 | // 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 141 | // 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 142 | // 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 143 | // 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 144 | // 6, 6, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 9, 9, 145 | // 9, 9, 9, 10, 10, 10, 10, 10, 11, 11, 11, 11, 11, 12, 12, 12, 146 | // 12, 12, 13, 13, 13, 13, 14, 14, 14, 14, 15, 15, 15, 15, 16, 16, 147 | // 16, 16, 17, 17, 17, 17, 18, 18, 18, 18, 19, 19, 19, 19, 20, 20, 148 | // 20, 21, 21, 21, 21, 22, 22, 22, 23, 23, 23, 23, 24, 24, 24, 25, 149 | // 25, 25, 26, 26, 26, 27, 27, 27, 28, 28, 28, 29, 29, 29, 30, 30, 150 | // 30, 31, 31, 31, 32, 32, 32, 33, 33, 33, 34, 34, 35, 35, 35, 36, 151 | // 36, 36, 37, 37, 38, 38, 38, 39, 39, 39, 40, 40, 41, 41, 41, 42, 152 | // 42, 43, 43, 44, 44, 44, 45, 45, 46, 46, 46, 47, 47, 48, 48, 49, 153 | // 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 54, 55, 55, 56, 154 | // 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63, 64, 155 | // 64, 65, 65, 66, 66, 67, 67, 68, 68, 69, 69, 70, 70, 71, 71, 72, 156 | // 72, 73, 73, 74, 74, 75, 76, 76, 77, 77, 78, 78, 79, 79, 80, 81, 157 | // 81, 82, 82, 83, 83, 84, 84, 85, 86, 86, 87, 87, 88, 89, 89, 90, 158 | // 90, 91, 92, 92, 93, 93, 94, 95, 95, 96, 96, 97, 98, 98, 99, 99, 159 | // 100,101,101,102,103,103,104,105,105,106,106,107,108,108,109,110, 160 | // 110,111,112,112,113,114,114,115,116,116,117,118,118,119,120,120, 161 | // 121,122,122,123,124,125,125,126,127,127,128,129,130,130,131,132, 162 | // 132,133,134,135,135,136,137,137,138,139,140,140,141,142,143,143, 163 | // 144,145,146,146,147,148,149,149,150,151,152,153,153,154,155,156, 164 | // 156,157,158,159,160,160,161,162,163,164,164,165,166,167,168,168, 165 | // 169,170,171,172,172,173,174,175,176,177,177,178,179,180,181,182, 166 | // 182,183,184,185,186,187,188,188,189,190,191,192,193,194,194,195, 167 | // 196,197,198,199,200,201,201,202,203,204,205,206,207,208,209,210, 168 | // 210,211,212,213,214,215,216,217,218,219,220,221,221,222,223,224, 169 | // 225,226,227,228,229,230,231,232,233,234,235,236,237,238,239,240, 170 | // 240,241,242,243,244,245,246,247,248,249,250,251,252,253,254,255, 171 | // 256,257,258,259,260,261,262,263,264,265,266,267,268,269,270,271, 172 | // 273,274,275,276,277,278,279,280,281,282,283,284,285,286,287,288, 173 | // 289,290,291,292,294,295,296,297,298,299,300,301,302,303,304,305, 174 | // 307,308,309,310,311,312,313,314,315,316,318,319,320,321,322,323, 175 | // 324,325,327,328,329,330,331,332,333,335,336,337,338,339,340,341, 176 | // 343,344,345,346,347,348,350,351,352,353,354,355,357,358,359,360, 177 | // 361,363,364,365,366,367,369,370,371,372,373,375,376,377,378,379, 178 | // 381,382,383,384,386,387,388,389,390,392,393,394,395,397,398,399, 179 | // 400,402,403,404,405,407,408,409,410,412,413,414,416,417,418,419, 180 | // 421,422,423,425,426,427,428,430,431,432,434,435,436,437,439,440, 181 | // 441,443,444,445,447,448,449,451,452,453,455,456,457,459,460,461, 182 | // 463,464,465,467,468,469,471,472,474,475,476,478,479,480,482,483, 183 | // 484,486,487,489,490,491,493,494,496,497,498,500,501,503,504,505, 184 | // 507,508,510,511,512,514,515,517,518,519,521,522,524,525,527,528, 185 | // 530,531,532,534,535,537,538,540,541,543,544,545,547,548,550,551, 186 | // 553,554,556,557,559,560,562,563,565,566,568,569,571,572,574,575, 187 | // 577,578,580,581,583,584,586,587,589,590,592,593,595,596,598,599, 188 | // 601,602,604,605,607,609,610,612,613,615,616,618,619,621,622,624, 189 | // 626,627,629,630,632,633,635,637,638,640,641,643,645,646,648,649, 190 | // 651,652,654,656,657,659,660,662,664,665,667,669,670,672,673,675, 191 | // 677,678,680,682,683,685,686,688,690,691,693,695,696,698,700,701, 192 | // 703,705,706,708,710,711,713,715,716,718,720,721,723,725,726,728, 193 | // 730,731,733,735,736,738,740,742,743,745,747,748,750,752,754,755, 194 | // 757,759,760,762,764,766,767,769,771,773,774,776,778,780,781,783, 195 | // 785,787,788,790,792,794,795,797,799,801,802,804,806,808,809,811, 196 | // 813,815,817,818,820,822,824,826,827,829,831,833,835,836,838,840, 197 | // 842,844,845,847,849,851,853,855,856,858,860,862,864,866,867,869, 198 | // 871,873,875,877,878,880,882,884,886,888,890,892,893,895,897,899, 199 | // 901,903,905,907,908,910,912,914,916,918,920,922,924,925,927,929, 200 | // 931,933,935,937,939,941,943,945,946,948,950,952,954,956,958,960, 201 | // 962,964,966,968,970,972,974,976,978,979,981,983,985,987,989,991, 202 | // 993,995,997,999,1001,1003,1005,1007,1009,1011,1013,1015,1017,1019,1021,1023 }; 203 | 204 | 205 | #endif 206 | -------------------------------------------------------------------------------- /RGB_WS2812_Light/src/RGB_WS2812_Light.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (c) 2019 ItKindaWorks All right reserved. 3 | github.com/ItKindaWorks 4 | 5 | This File is free software: you can redistribute it and/or modify 6 | it under the terms of the GNU General Public License as published by 7 | the Free Software Foundation, either version 3 of the License, or 8 | (at your option) any later version. 9 | 10 | This File is distributed in the hope that it will be useful, 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 | GNU General Public License for more details. 14 | 15 | You should have received a copy of the GNU General Public License 16 | along with This File. If not, see . 17 | */ 18 | #include "ESPHelper_base.h" 19 | #include 20 | #include "FastLED.h" 21 | #include "myTypes.h" 22 | 23 | 24 | #define AFFIRM_REQ(SUB_TEXT, SUB_DATA) String("\ 25 |
\ 26 | Updated!\ 27 |
\ 28 | \ 29 |

" SUB_TEXT " " + SUB_DATA + "
\ 30 | \ 31 | \ 32 | ") 33 | 34 | //invalid input http str 35 | const String INVALID_REQUEST_STR = String("\ 36 |

\ 37 | Bad Input\ 38 |
\ 39 | \ 40 |

400: Invalid Request
\ 41 | \ 42 | \ 43 | "); 44 | 45 | ///////////////////////// Pin Definitions ///////////////////////// 46 | 47 | const int ledPin = D2; 48 | 49 | ///////////////////////// Networking ///////////////////////// 50 | 51 | //bool set to true when the system has just connected or reconnected. Allows us to ping the IP 52 | //or do whatever else is necessary when we connect to wifi 53 | bool justReconnected = true; 54 | 55 | 56 | 57 | ///////////////////////// Timers ///////////////////////// 58 | 59 | 60 | ///////////////////////// Sensors ///////////////////////// 61 | 62 | 63 | 64 | ///////////////////////// Config Keys ///////////////////////// 65 | 66 | char topic[64]; 67 | char statusTopic[64]; 68 | 69 | 70 | ///////////////////////// Other ///////////////////////// 71 | #define GRAD_DELTA 1 72 | #define GRAD_CALC gradIndex - (i * GRAD_DELTA) 73 | 74 | 75 | const int MAX_LEDS = 255; 76 | CRGB leds[MAX_LEDS]; 77 | int numLEDS = 1; 78 | 79 | 80 | 81 | enum superModes {SET, MOOD, RAINBOW}; 82 | enum moodColors{RED, GREEN, BLUE}; 83 | enum modes {NORMAL, FADING}; 84 | enum updateTypes{HSB_UPDATE, RGB_UPDATE, POWER_UPDATE}; 85 | 86 | lightState nextState; 87 | 88 | lightState statusValues; 89 | 90 | int superMode = SET; //overall mode of the light (moodlight, network controlled, music bounce, etc) 91 | boolean newCommand = false; 92 | 93 | unsigned long currentMillis = 0; 94 | 95 | int timeout = 0; //timeout timer to fail to standard moodlight when no known wifi is found within 10 seconds 96 | 97 | 98 | 99 | 100 | 101 | void setup() { 102 | Serial.begin(115200); 103 | checkFS(); 104 | 105 | delay(1000); 106 | Serial.println("\n\nESP WS2812B LED Controller Version 1.0"); 107 | Serial.println("Starting Up..."); 108 | 109 | Serial.println("Loading controller configuration"); 110 | loadOtherCfg(); 111 | 112 | 113 | 114 | ///////////////////////// IO init ///////////////////////// 115 | Serial.println("Setting up LEDs"); 116 | Serial.print("Set LED Count: "); 117 | Serial.println(numLEDS); 118 | delay(10); 119 | FastLED.addLeds(leds, numLEDS); 120 | for(int i = 0; i < numLEDS; i++){ 121 | leds[i] = CRGB::Black; 122 | } 123 | FastLED.show(); 124 | 125 | ///////////////////////// Network Init ///////////////////////// 126 | 127 | Serial.println("Starting WiFi"); 128 | //startup the wifi and web server 129 | startWifi(true); 130 | 131 | Serial.println("Setting Up Web Server"); 132 | configPage.fillConfig(&config); 133 | configPage.begin(config.hostname); 134 | server.on("/", HTTP_GET, handleStatus); 135 | server.on("/numLEDS", HTTP_POST, handleLEDCountChange); 136 | server.on("/topicUpdate", HTTP_POST, handleTopicUpdate); 137 | 138 | //UNCOMMENT THIS LINE TO ENABLE MQTT CALLBACK 139 | myESP.setCallback(callback); 140 | myESP.addSubscription(topic); 141 | 142 | server.begin(); // Actually start the server 143 | 144 | Serial.println("Setup Finished. Running Main Loop..."); 145 | } 146 | 147 | void loop(){ 148 | while(1){ 149 | ///////////////////////// Background Routines ///////////////////////// 150 | currentMillis = millis(); 151 | 152 | ///////////////////////// Network Handling ///////////////////////// 153 | 154 | //get the current status of ESPHelper 155 | int espHelperStatus = myESP.loop(); 156 | manageESPHelper(espHelperStatus); 157 | 158 | if(espHelperStatus >= WIFI_ONLY){ 159 | 160 | if(espHelperStatus == FULL_CONNECTION){ 161 | //full connection loop code here 162 | lightHandler(); 163 | } 164 | 165 | if(justReconnected){ 166 | 167 | //post to mqtt if connected 168 | if(espHelperStatus == FULL_CONNECTION){ 169 | myESP.publish("/home/IP", String(String(myESP.getHostname()) + " -- " + String(myESP.getIP()) ).c_str() ); 170 | } 171 | Serial.print("Connected to network with IP: "); 172 | Serial.println(myESP.getIP()); 173 | justReconnected = false; 174 | } 175 | 176 | } 177 | 178 | //loop delay can be down to 1ms if needed. Shouldn't go below that though 179 | //(ie dont use 'yield' if it can be avoided) 180 | delay(1); 181 | } 182 | 183 | } 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | void lightHandler(){ 210 | static lightState newState; 211 | static lightState currentState; 212 | static int currentMoodColor = 0; 213 | 214 | static int isFading = 0; 215 | 216 | static int gHue = 0; 217 | 218 | if(superMode == RAINBOW){ 219 | Serial.println("Rainbow"); 220 | fill_rainbow( leds, numLEDS, gHue, 2); 221 | if(millis() % 13 == 0){gHue++;} 222 | if(gHue > 255){gHue = 0;} 223 | FastLED.show(); 224 | return; 225 | } 226 | 227 | //handle color fading 228 | if(superMode == MOOD && isFading == 0){ 229 | // fadePeriod = 4000; 230 | if(currentMoodColor == RED){ 231 | nextState.red = 0; 232 | nextState.green = 255; 233 | nextState.blue = 0; 234 | nextState.updateType = RGB; 235 | newCommand = true; 236 | currentMoodColor = GREEN; 237 | 238 | } 239 | else if(currentMoodColor == GREEN){ 240 | nextState.red = 0; 241 | nextState.green = 0; 242 | nextState.blue = 255; 243 | nextState.updateType = RGB; 244 | newCommand = true; 245 | currentMoodColor = BLUE; 246 | } 247 | else if(currentMoodColor == BLUE){ 248 | nextState.red = 255; 249 | nextState.green = 0; 250 | nextState.blue = 0; 251 | nextState.updateType = RGB; 252 | newCommand = true; 253 | currentMoodColor = RED; 254 | } 255 | } 256 | 257 | //update target and current light values 258 | lightUpdater(&newState, currentState); 259 | isFading = lightChanger(newState, ¤tState); 260 | 261 | } 262 | 263 | 264 | int lightChanger(lightState newState, lightState *currentState){ 265 | static timer changeTimer; 266 | changeTimer.interval = 1; 267 | 268 | static int changeMode = NORMAL; 269 | static int currentPeriod = 0; 270 | 271 | //if it is time to update the lights 272 | if(checkTimer(&changeTimer.previousTime, changeTimer.interval)){ 273 | 274 | //check for a new command and update the mode 275 | if(newCommand){ 276 | Serial.println("New HSV command, updating lights. Mode set to FADING"); 277 | newCommand = false; 278 | changeMode = FADING; 279 | } 280 | 281 | 282 | //activly in the middle of a fade 283 | if(changeMode == FADING){ 284 | // Serial.println("Fading Lights"); 285 | 286 | //check if all colors are at their target state or if we are still in the middle of a fade operation 287 | //and have not timed out. 288 | if((newState.red != currentState->red || \ 289 | newState.blue != currentState->blue || \ 290 | newState.green != currentState->green) || \ 291 | (currentPeriod <= currentState->fadePeriod)){ 292 | 293 | //only update the channels if it is time for them to update. 294 | //Each channel has it's own timing so that all channels end 295 | //at the same time. 296 | 297 | if(currentPeriod % newState.redRate == 0){ 298 | //fade up if color is too low 299 | if(newState.red > currentState->red){currentState->red++;} 300 | //otherwise fade down 301 | else if (newState.red < currentState->red){currentState->red--;} 302 | } 303 | 304 | if(currentPeriod % newState.greenRate == 0){ 305 | //fade up if color is too low 306 | if(newState.green > currentState->green){currentState->green++;} 307 | //otherwise fade down 308 | else if (newState.green < currentState->green){currentState->green--;} 309 | } 310 | 311 | if(currentPeriod % newState.blueRate == 0){ 312 | //fade up if color is too low 313 | if(newState.blue > currentState->blue){currentState->blue++;} 314 | //otherwise fade down 315 | else if (newState.blue < currentState->blue){currentState->blue--;} 316 | } 317 | 318 | //write any changes to the pins 319 | // analogWrite(redPin, currentState->red); 320 | // analogWrite(greenPin, currentState->green); 321 | // analogWrite(bluePin, currentState->blue); 322 | 323 | CRGB color = CRGB(currentState->red, currentState->green, currentState->blue); 324 | for (int i = 0; i < numLEDS; i++){leds[i] = color;} 325 | FastLED.show(); 326 | 327 | //update the status values for displaying on the web page. This is needed 328 | //because the current led values are stored in a static var in lightHandler. 329 | //this could be fixed in the future when refactoring 330 | statusValues.red = currentState->red; 331 | statusValues.green = currentState->green; 332 | statusValues.blue = currentState->blue; 333 | 334 | // Serial.println("Done"); 335 | 336 | //increment the current period. 337 | currentPeriod++; 338 | return 1; 339 | } 340 | else{ 341 | Serial.println("Fading finished - returning to NORMAL"); 342 | currentPeriod = 0; 343 | changeMode = NORMAL; 344 | return 0; 345 | } 346 | 347 | } 348 | 349 | 350 | else if (changeMode == NORMAL){ 351 | return 0; 352 | } 353 | 354 | } 355 | 356 | return -1; 357 | 358 | } 359 | 360 | 361 | void lightUpdater (lightState *newState, lightState currentState){ 362 | 363 | //check for a new command 364 | if (newCommand){ 365 | Serial.println("Processing Latest Update"); 366 | 367 | //hue sat val update (vs RGB) 368 | if(nextState.updateType == HSB_UPDATE){ 369 | Serial.println("Update was HSV"); 370 | 371 | //convert from HSV targets to RGB targets 372 | int newRGB[3]; 373 | H2R_HSBtoRGBfloat(nextState.hue, nextState.saturation, nextState.brightness, newRGB); 374 | newState->red = newRGB[0]; 375 | newState->green = newRGB[1]; 376 | newState->blue = newRGB[2]; 377 | 378 | //find the number of steps to move for each channel 379 | int redDiff = abs(newState->red - currentState.red); 380 | int greenDiff = abs(newState->green - currentState.green); 381 | int blueDiff = abs(newState->blue - currentState.blue); 382 | 383 | //figure out how long each fade step needs to be for each channel 384 | //else handles when there are no steps needed because div/0 is bad. 385 | //if statement divides fadePeriod / diff and if div is 0 then we get 386 | //#bad things. 387 | 388 | if(redDiff > 0){newState->redRate = (nextState.fadePeriod / redDiff);} 389 | else{newState->redRate = nextState.fadePeriod;} 390 | 391 | if(greenDiff > 0){newState->greenRate = (nextState.fadePeriod / greenDiff);} 392 | else{newState->greenRate = nextState.fadePeriod;} 393 | 394 | if(blueDiff > 0){newState->blueRate = (nextState.fadePeriod / blueDiff);} 395 | else{newState->blueRate = nextState.fadePeriod;} 396 | 397 | // Serial.println("Rates (RGB):"); 398 | // Serial.println(newState->redRate); 399 | // Serial.println(newState->greenRate); 400 | // Serial.println(newState->blueRate); 401 | 402 | if(newState->redRate == 0){newState->redRate = 1;} 403 | if(newState->greenRate == 0){newState->greenRate = 1;} 404 | if(newState->blueRate == 0){newState->blueRate = 1;} 405 | 406 | //update the fade period 407 | newState->fadePeriod = nextState.fadePeriod; 408 | 409 | Serial.println("Done."); 410 | 411 | } 412 | 413 | //RGB update (vs HSV) 414 | else if(nextState.updateType == RGB_UPDATE){ 415 | Serial.println("Update was RGB"); 416 | 417 | //grab the new RGB values from the mqtt light struct 418 | newState->red = nextState.red; 419 | newState->green = nextState.green; 420 | newState->blue = nextState.blue; 421 | 422 | //find the number of steps to move for each channel 423 | int redDiff = abs(newState->red - currentState.red); 424 | int greenDiff = abs(newState->green - currentState.green); 425 | int blueDiff = abs(newState->blue - currentState.blue); 426 | 427 | //figure out how long each fade step needs to be for each channel 428 | //else handles when there are no steps needed because div/0 is bad. 429 | //if statement divides fadePeriod / diff and if div is 0 then we get 430 | //#bad things. (also not sure atm why I am +1 to the rate here...) 431 | if(redDiff > 0){newState->redRate = (nextState.fadePeriod / redDiff) + 1;} 432 | else{newState->redRate = nextState.fadePeriod;} 433 | 434 | if(greenDiff > 0){newState->greenRate = (nextState.fadePeriod / greenDiff) + 1;} 435 | else{newState->greenRate = nextState.fadePeriod;} 436 | 437 | if(blueDiff > 0){newState->blueRate = (nextState.fadePeriod / blueDiff) + 1;} 438 | else{newState->blueRate = nextState.fadePeriod;} 439 | 440 | //update the fade period 441 | newState->fadePeriod = nextState.fadePeriod; 442 | 443 | Serial.println("Done."); 444 | } 445 | } 446 | 447 | } 448 | 449 | 450 | 451 | //MQTT callback 452 | //input: topic ptr, payload ptr, size of payload 453 | //output: none 454 | void callback(char* topic, byte* payload, unsigned int length) { 455 | 456 | //convert topic to string to make it easier to work with 457 | String topicStr = topic; 458 | 459 | 460 | //fix the payload string by creating a new one and adding a null terminator. 461 | char newPayload[40]; 462 | memcpy(newPayload, payload, length); 463 | newPayload[length] = '\0'; 464 | 465 | 466 | Serial.println("Got New Command"); 467 | Serial.println(topicStr); 468 | Serial.println(newPayload); 469 | 470 | //publish back to the status topic as feedback to the system 471 | myESP.publish(statusTopic, newPayload); //ping back to the status topic 472 | 473 | Serial.println("Processing..."); 474 | Serial.println(newPayload[0]); 475 | 476 | //hsv command 477 | if(newPayload[0] == 'h'){ 478 | 479 | //convert c string to floats for hsv 480 | nextState.hue = atof(&newPayload[1]); 481 | nextState.saturation = atof(&newPayload[7]); 482 | nextState.brightness = atof(&newPayload[13]); 483 | 484 | //set the update type and fade speed 485 | nextState.updateType = HSB_UPDATE; 486 | nextState.fadePeriod = 200; 487 | 488 | //mark a new command 489 | newCommand = true; 490 | 491 | //make sure that the mode is set to SET (vs MOOD or other mode) 492 | superMode = SET; 493 | 494 | Serial.println("HSV command receieved"); 495 | 496 | } 497 | 498 | //rgb command 499 | else if (newPayload[0] == 'r'){ 500 | //convert c string to ints for rgb 501 | nextState.red = atoi(&newPayload[1]); 502 | nextState.green = atoi(&newPayload[5]); 503 | nextState.blue = atoi(&newPayload[9]); 504 | 505 | //set the update type and fade speed 506 | nextState.updateType = RGB_UPDATE; 507 | nextState.fadePeriod = 2100; 508 | 509 | //mark a new command 510 | newCommand = true; 511 | 512 | //make sure that the mode is set to SET (vs MOOD or other mode) 513 | superMode = SET; 514 | } 515 | 516 | //set mood light mode ('m1' or 'm0') 517 | else if(newPayload[0] == 'm'){ 518 | Serial.println(newPayload[1]); 519 | //enable mood light 520 | if(newPayload[1] == '1'){ 521 | superMode = RAINBOW; 522 | newCommand = true; 523 | } 524 | 525 | //turn off moodlight 526 | else if(newPayload[1] == '0'){ 527 | superMode = SET; 528 | nextState.fadePeriod = 2100; 529 | newCommand = true; 530 | } 531 | } 532 | 533 | //set for audio bounce mode. (not implemented yet) 534 | else if(newPayload[0] == 'a'){ 535 | } 536 | 537 | } 538 | 539 | 540 | //performs a map operation but for floating point numbers 541 | //input: starting val, starting val minimum, starting val maxiumum, output minimum, output maximum 542 | //output: mapped value between out_min and out_max (double) 543 | float map_double(double x, double in_min, double in_max, double out_min, double out_max) 544 | { 545 | return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min; 546 | } 547 | 548 | 549 | //this functions simplifies checking whether a task needs to run by checking our timing variables 550 | //and returning true or false depending on whether we need to run or not 551 | boolean checkTimer(unsigned long *previousTime, unsigned long interval){ 552 | if(currentMillis - *previousTime >= interval){ 553 | *previousTime = currentMillis; 554 | return true; 555 | } 556 | return false; 557 | } 558 | 559 | 560 | 561 | 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 | 575 | 576 | 577 | 578 | 579 | 580 | 581 | 582 | void loadOtherCfg(){ 583 | ESPHelperFS::begin(); 584 | 585 | //Remember to change this to whatever file you want to store/read your custom config from 586 | const char* file = "/config.json"; 587 | 588 | //read the topic from memory (or use a default topic if there is an error) 589 | loadKey("topic", file, topic, sizeof(topic), "/home/test"); 590 | //create a temporary string to do some concating to eventually assign to the status topic 591 | String tempTopic = topic; 592 | tempTopic += "/status"; 593 | tempTopic.toCharArray(statusTopic, sizeof(statusTopic)); 594 | 595 | loadKey("numLEDS", file, &numLEDS); 596 | numLEDS = constrain(numLEDS, 1, MAX_LEDS); 597 | 598 | // loadKey("Key", file, someFloat); 599 | // loadKey("thingUser", file, someStr, sizeof(someStr)); 600 | 601 | ESPHelperFS::end(); 602 | } 603 | 604 | 605 | 606 | 607 | //main config page that allows user to enter in configuration info 608 | void handleStatus() { 609 | server.send(200, "text/html", \ 610 | String("\ 611 |

\ 612 | Device Info\ 613 |
\ 614 | \ 615 |

System Status
\ 616 | Device Name: " + String(config.hostname) + "
\ 617 | Connected SSID: " + String(myESP.getSSID()) + "
\ 618 | Device IP: " + String(myESP.getIP()) + "
\ 619 | Uptime (ms): " + String(millis()) + "

\ 620 |

\ 621 | \ 622 | \ 623 | \ 627 | \ 628 | \ 629 | \ 630 | \ 631 | \ 632 |
\ 633 | Update Topic:
\ 634 |
\ 635 | \ 636 | \ 637 |
\ 638 | Update Topic:
\ 639 |
\ 640 | \ 641 | \ 642 | ")); 643 | } 644 | 645 | 646 | //handler function for updating the relay timer 647 | void handleTopicUpdate() { 648 | 649 | const char* keyName = "topic"; 650 | 651 | //Remember to change this to whatever file you want to store/read your custom config from 652 | const char* file = "/config.json"; 653 | 654 | //make sure that all the arguments exist and that at least an SSID and hostname have been entered 655 | if(!server.hasArg(keyName)){ 656 | server.send(400, "text/plain", INVALID_REQUEST_STR); 657 | return; 658 | } 659 | 660 | //handle int/float 661 | // int data = server.arg(keyName).toInt(); 662 | // char buf[20]; 663 | // String tmp = String(data); 664 | // tmp.toCharArray(buf, sizeof(buf)); 665 | 666 | //handle string 667 | char buf[64]; 668 | server.arg(keyName).toCharArray(buf, sizeof(buf)); 669 | 670 | myESP.removeSubscription(topic); 671 | 672 | //save the key to flash and refresh data var with data from flash 673 | addKey(keyName, buf , file); 674 | loadKey(keyName, file, topic, sizeof(topic), "/home/test"); 675 | 676 | myESP.addSubscription(topic); 677 | 678 | //tell the user that the config is loaded in and the module is restarting 679 | server.send(200, "text/html",AFFIRM_REQ("Updated Topic To: " , String(topic))); 680 | 681 | } 682 | 683 | 684 | 685 | //handler function for updating the relay timer 686 | void handleLEDCountChange() { 687 | 688 | const char* keyName = "numLEDS"; 689 | 690 | //Remember to change this to whatever file you want to store/read your custom config from 691 | const char* file = "/config.json"; 692 | 693 | //make sure that all the arguments exist and that at least an SSID and hostname have been entered 694 | if(!server.hasArg(keyName)){ 695 | server.send(400, "text/plain", INVALID_REQUEST_STR); 696 | return; 697 | } 698 | 699 | // handle int/float 700 | int data = server.arg(keyName).toInt(); 701 | char buf[20]; 702 | String tmp = String(data); 703 | tmp.toCharArray(buf, sizeof(buf)); 704 | 705 | //save the key to flash and refresh data var with data from flash 706 | addKey(keyName, buf , file); 707 | loadKey(keyName, file, &numLEDS); 708 | 709 | 710 | FastLED.addLeds(leds, numLEDS); 711 | for(int i = 0; i < numLEDS; i++){ 712 | leds[i] = leds[0]; 713 | } 714 | FastLED.show(); 715 | 716 | 717 | //tell the user that the config is loaded in and the module is restarting 718 | server.send(200, "text/html",AFFIRM_REQ("Updated Led Count To: " , String(numLEDS))); 719 | 720 | } 721 | -------------------------------------------------------------------------------- /LED_bedsideTable.lbrn: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | 131 | 132 | 133 | 134 | 135 | 136 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | 158 | 159 | 160 | 161 | 162 | 163 | 164 | 165 | 166 | 167 | 168 | 169 | 170 | 171 | 172 | 173 | 174 | 175 | 176 | 177 | 178 | 179 | 180 | 181 | 182 | 183 | 184 | 185 | 186 | 187 | 188 | 189 | 190 | 191 | 192 | 193 | 194 | 195 | 196 | 197 | 198 | 199 | 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207 | 208 | 209 | 210 | 211 | 212 | 213 | 214 | 215 | 216 | 217 | 218 | 219 | 220 | 221 | 222 | 223 | 224 | 225 | 226 | 227 | 228 | 229 | 230 | 231 | 232 | 233 | 234 | 235 | 236 | 237 | 238 | 239 | 240 | 241 | 242 | 243 | 244 | 245 | 246 | 247 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 248 | 249 | 250 | 251 | 252 |

253 |

254 |

255 |

256 | 257 | 258 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 259 | 260 | 261 | 262 | 263 |

264 |

265 |

266 |

267 | 268 | 269 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 270 | 271 | 272 |

273 | 274 | 275 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 276 | 277 | 278 |

279 | 280 | 281 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 282 | 283 | 284 |

285 | 286 | 287 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 288 | 289 | 290 |

291 | 292 | 293 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 294 | 295 | 296 |

297 | 298 | 299 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 300 | 301 | 302 |

303 | 304 | 305 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 306 | 307 | 308 |

309 | 310 | 311 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 312 | 313 | 314 |

315 | 316 | 317 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 318 | 319 | 320 |

321 | 322 | 323 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 324 | 325 | 326 |

327 | 328 | 329 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 330 | 331 | 332 |

333 | 334 | 335 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 336 | 337 | 338 |

339 | 340 | 341 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 342 | 343 | 344 |

345 | 346 | 347 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 348 | 349 | 350 |

351 | 352 | 353 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 354 | 355 | 356 |

357 | 358 | 359 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 360 | 361 | 362 |

363 | 364 | 365 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 366 | 367 | 368 |

369 | 370 | 371 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 372 | 373 | 374 |

375 | 376 | 377 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 378 | 379 | 380 |

381 | 382 | 383 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 384 | 385 | 386 |

387 | 388 | 389 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 390 | 391 | 392 |

393 | 394 | 395 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 396 | 397 | 398 |

399 | 400 | 401 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 402 | 403 | 404 |

405 | 406 | 407 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 408 | 409 | 410 |

411 | 412 | 413 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 414 | 415 | 416 |

417 | 418 | 419 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 420 | 421 | 422 |

423 | 424 | 425 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 426 | 427 | 428 |

429 | 430 | 431 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 432 | 433 | 434 |

435 | 436 | 437 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 438 | 439 | 440 |

441 | 442 | 443 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 444 | 445 | 446 |

447 | 448 | 449 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 450 | 451 | 452 |

453 | 454 | 455 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 456 | 457 | 458 | 459 | 460 |

461 |

462 |

463 |

464 | 465 | 466 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 467 | 468 | 469 | 470 | 471 |

472 |

473 |

474 |

475 | 476 | 477 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 478 | 479 | 480 | 481 | 482 |

483 |

484 |

485 |

486 | 487 | 488 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 489 | 490 | 491 | 492 | 493 | 494 | 495 | 496 | 497 | 498 |

499 |

500 |

501 |

502 |

503 |

504 |

505 |

506 |

507 | 508 | 509 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 510 | 511 | 512 | 513 | 514 | 515 | 516 | 517 | 518 | 519 | 520 | 521 |

522 |

523 |

524 |

525 |

526 |

527 |

528 |

529 |

530 |

531 |

532 | 533 | 534 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 535 | 536 | 537 | 538 | 539 | 540 | 541 | 542 | 543 | 544 | 545 | 546 | 547 |

548 |

549 |

550 |

551 |

552 |

553 |

554 |

555 |

556 |

557 |

558 |

559 | 560 | 561 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 562 | 563 | 564 | 565 | 566 | 567 | 568 | 569 | 570 | 571 | 572 | 573 | 574 |

575 |

576 |

577 |

578 |

579 |

580 |

581 |

582 |

583 |

584 |

585 |

586 | 587 | 588 | -1 -8.74228e-08 8.74228e-08 -1 694.9 616.8 589 | 590 | 591 | 592 | 593 | 594 | 595 | 596 | 597 | 598 | 599 | 600 | 601 | 602 |

603 |

604 |

605 |

606 |

607 |

608 |

609 |

610 |

611 |

612 |

613 |

614 |

615 | 616 | 617 | -1 -8.74228e-08 8.74228e-08 -1 696.4 616.8 618 | 619 | 620 |

621 | 622 | 623 | 624 | --------------------------------------------------------------------------------