├── Serial2Net_ESP8266 ├── lib │ ├── FancyLED │ │ ├── .gitignore │ │ ├── examples │ │ │ ├── FancyLED_Ex02_Toggle │ │ │ │ └── FancyLED_Ex02_Toggle.pde │ │ │ ├── FancyLED_Ex01_OnAndOff │ │ │ │ └── FancyLED_Ex01_OnAndOff.pde │ │ │ ├── FancyLED_Ex04_Blink_N_Times_With_Delayed_Start │ │ │ │ └── FancyLED_Ex04_Blink_N_Times_With_Delayed_Start.pde │ │ │ ├── FancyLED_Ex03_Blink_N_Times │ │ │ │ └── FancyLED_Ex03_Blink_N_Times.pde │ │ │ ├── FancyLED_Ex06_EightLEDs │ │ │ │ └── FancyLED_Ex06_EightLEDs.pde │ │ │ └── FancyLED_Ex05_AsRegisterBit │ │ │ │ └── FancyLED_Ex05_AsRegisterBit.pde │ │ ├── keywords.txt │ │ ├── FancyLED.h │ │ ├── README.txt │ │ └── FancyLED.cpp │ └── SyncLED │ │ ├── examples │ │ ├── .svn │ │ │ ├── all-wcprops │ │ │ └── entries │ │ ├── blink_sos │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── text-base │ │ │ │ │ └── blink_sos.pde.svn-base │ │ │ │ └── entries │ │ │ └── blink_sos.pde │ │ ├── blink_easy │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── text-base │ │ │ │ │ └── blink_easy.pde.svn-base │ │ │ │ └── entries │ │ │ └── blink_easy.pde │ │ ├── blink_fade │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── entries │ │ │ │ └── text-base │ │ │ │ │ └── blink_fade.pde.svn-base │ │ │ └── blink_fade.pde │ │ ├── blink_basic │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── text-base │ │ │ │ │ └── blink_basic.pde.svn-base │ │ │ │ └── entries │ │ │ └── blink_basic.pde │ │ ├── blink_basic2 │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── text-base │ │ │ │ │ └── blink_basic2.pde.svn-base │ │ │ │ └── entries │ │ │ └── blink_basic2.pde │ │ ├── blink_custom │ │ │ ├── .svn │ │ │ │ ├── all-wcprops │ │ │ │ ├── text-base │ │ │ │ │ └── blink_custom.pde.svn-base │ │ │ │ └── entries │ │ │ └── blink_custom.pde │ │ └── blink_faster │ │ │ ├── .svn │ │ │ ├── all-wcprops │ │ │ ├── entries │ │ │ └── text-base │ │ │ │ └── blink_faster.pde.svn-base │ │ │ └── blink_faster.pde │ │ ├── documentation.txt │ │ ├── .svn │ │ ├── text-base │ │ │ ├── documentation.txt.svn-base │ │ │ ├── SyncLED.h.svn-base │ │ │ └── SyncLED.cpp.svn-base │ │ ├── all-wcprops │ │ └── entries │ │ ├── SyncLED.h │ │ └── SyncLED.cpp ├── config.default.h ├── test_leds.ino.txt └── Serial2Net_ESP8266.ino ├── images ├── wiring.png └── schematic.png ├── hardware └── Wiring.fzz ├── .gitignore ├── platformio.ini ├── README.md └── COPYING /Serial2Net_ESP8266/lib/FancyLED/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /images/wiring.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soif/Serial2Net_ESP8266/HEAD/images/wiring.png -------------------------------------------------------------------------------- /hardware/Wiring.fzz: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soif/Serial2Net_ESP8266/HEAD/hardware/Wiring.fzz -------------------------------------------------------------------------------- /images/schematic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/soif/Serial2Net_ESP8266/HEAD/images/schematic.png -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 38 4 | /svn/!svn/ver/2/trunk/SyncLED/examples 5 | END 6 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Mac hidden files ---------- 3 | .AppleDouble 4 | :2e* 5 | /Icon* 6 | .#* 7 | .afpDeleted* 8 | 9 | # PlatformIO ---------- 10 | .pioenvs 11 | .piolibdeps 12 | .clang_complete 13 | .gcc-flags.json 14 | 15 | # ————————————————— 16 | Serial2Net_ESP8266/config_* 17 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/documentation.txt: -------------------------------------------------------------------------------- 1 | SyncLED library for Arduino 2 | 3 | Version 1.0 4 | 5 | by Byron Guernsey 6 | 7 | contact: okachobi@gmail.com 8 | 9 | See the online documentation here: http://code.google.com/p/arduino-library-syncled/ 10 | See examples/ directory for simple examples 11 | 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_sos/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 48 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_sos 5 | END 6 | blink_sos.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 62 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_sos/blink_sos.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_easy/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 49 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_easy 5 | END 6 | blink_easy.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 64 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_easy/blink_easy.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_fade/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 49 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_fade 5 | END 6 | blink_fade.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 64 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_fade/blink_fade.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 50 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_basic 5 | END 6 | blink_basic.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 66 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_basic/blink_basic.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic2/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 51 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_basic2 5 | END 6 | blink_basic2.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 68 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_basic2/blink_basic2.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_custom/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 51 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_custom 5 | END 6 | blink_custom.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 68 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_custom/blink_custom.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_faster/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 51 4 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_faster 5 | END 6 | blink_faster.pde 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 68 10 | /svn/!svn/ver/2/trunk/SyncLED/examples/blink_faster/blink_faster.pde 11 | END 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/.svn/text-base/documentation.txt.svn-base: -------------------------------------------------------------------------------- 1 | SyncLED library for Arduino 2 | 3 | Version 1.0 4 | 5 | by Byron Guernsey 6 | 7 | contact: okachobi@gmail.com 8 | 9 | See the online documentation here: http://code.google.com/p/arduino-library-syncled/ 10 | See examples/ directory for simple examples 11 | 12 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic2/blink_basic2.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | // Define a pattern here 8 | // This pattern is the equivilent of examples/blink_basic (400ms on, 200ms off) 9 | StatusLight.blinkPattern( 0B001111UL, 100, 6); 10 | } 11 | 12 | void loop() { 13 | StatusLight.update(); 14 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic2/.svn/text-base/blink_basic2.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | // Define a pattern here 8 | // This pattern is the equivilent of examples/blink_basic (400ms on, 200ms off) 9 | StatusLight.blinkPattern( 0B001111UL, 100, 6); 10 | } 11 | 12 | void loop() { 13 | StatusLight.update(); 14 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic/blink_basic.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | // No setup required here 8 | } 9 | 10 | void loop() { 11 | 12 | // Turn the light on 13 | StatusLight.On(); 14 | // Wait some time 15 | delay(400); 16 | // Turn the light off 17 | StatusLight.Off(); 18 | // Wait some more time 19 | delay(200); 20 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_sos/blink_sos.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink SOS Pattern 9 | // This pattern length is the maximum of 32 bits - we cannot go longer with an unsigned long 10 | StatusLight.blinkPattern( 0B000000101010001110111011100010101UL, 150, 32 ); 11 | } 12 | 13 | void loop() { 14 | StatusLight.update(); 15 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic/.svn/text-base/blink_basic.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | // No setup required here 8 | } 9 | 10 | void loop() { 11 | 12 | // Turn the light on 13 | StatusLight.On(); 14 | // Wait some time 15 | delay(400); 16 | // Turn the light off 17 | StatusLight.Off(); 18 | // Wait some more time 19 | delay(200); 20 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/.svn/all-wcprops: -------------------------------------------------------------------------------- 1 | K 25 2 | svn:wc:ra_dav:version-url 3 | V 29 4 | /svn/!svn/ver/2/trunk/SyncLED 5 | END 6 | SyncLED.cpp 7 | K 25 8 | svn:wc:ra_dav:version-url 9 | V 41 10 | /svn/!svn/ver/2/trunk/SyncLED/SyncLED.cpp 11 | END 12 | SyncLED.h 13 | K 25 14 | svn:wc:ra_dav:version-url 15 | V 39 16 | /svn/!svn/ver/2/trunk/SyncLED/SyncLED.h 17 | END 18 | documentation.txt 19 | K 25 20 | svn:wc:ra_dav:version-url 21 | V 47 22 | /svn/!svn/ver/2/trunk/SyncLED/documentation.txt 23 | END 24 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_sos/.svn/text-base/blink_sos.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink SOS Pattern 9 | // This pattern length is the maximum of 32 bits - we cannot go longer with an unsigned long 10 | StatusLight.blinkPattern( 0B000000101010001110111011100010101UL, 150, 32 ); 11 | } 12 | 13 | void loop() { 14 | StatusLight.update(); 15 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_easy/blink_easy.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default setting- no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink the LED 5 times with a default duration of 1000ms between blinks and 9 | // a delay of 4 x duration (4 seconds) between series of blinks (a pause) 10 | // Note the type of "byte" being used to differentiate from the unsigned long 11 | // used in the more advanced examples 12 | StatusLight.blinkPattern( (byte) 5); 13 | 14 | } 15 | 16 | void loop() { 17 | StatusLight.update(); 18 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_easy 30 | dir 31 | 32 | blink_basic 33 | dir 34 | 35 | blink_basic2 36 | dir 37 | 38 | blink_sos 39 | dir 40 | 41 | blink_faster 42 | dir 43 | 44 | blink_custom 45 | dir 46 | 47 | blink_fade 48 | dir 49 | 50 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_easy/.svn/text-base/blink_easy.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default setting- no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink the LED 5 times with a default duration of 1000ms between blinks and 9 | // a delay of 4 x duration (4 seconds) between series of blinks (a pause) 10 | // Note the type of "byte" being used to differentiate from the unsigned long 11 | // used in the more advanced examples 12 | StatusLight.blinkPattern( (byte) 5); 13 | 14 | } 15 | 16 | void loop() { 17 | StatusLight.update(); 18 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_custom/blink_custom.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink a custom pattern indicated by a binary number 9 | // Bits a read from right to left 10 | // 0B0101UL indicates On, Off, On, Off (in that order) 11 | // Each bit represents 200ms of time 12 | // The pattern length is 4 bits 13 | // 14 | // Note the UL on the pattern to cast it as a unsigned long 15 | // This is required because of a similar call which takes a byte argument 16 | StatusLight.blinkPattern( 0B0101UL, 200, 4 ); 17 | } 18 | 19 | void loop() { 20 | StatusLight.update(); 21 | } -------------------------------------------------------------------------------- /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 | [platformio] 12 | src_dir=Serial2Net_ESP8266 13 | lib_extra_dirs=Serial2Net_ESP8266/lib 14 | lib_dir=/Volumes/DOCS/DEV/Arduino/libraries 15 | 16 | [env:esp07] 17 | platform = espressif8266 18 | board = esp07 19 | framework = arduino 20 | upload_port = /dev/cu.wchusbserialfa140 21 | ;upload_speed = 921600 ;460800 22 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_faster/blink_faster.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink the LED 5 times with a duration of 200ms between blinks 9 | // and an automatic 4 x Duration (800 milliseconds) delay between series of blinks 10 | // 11 | // This is useful for setting a simple blink status code 12 | // If you do not want the pause between series, please see the 13 | // examples/blink_custom and examples/blink_basic2 to setup a repeating 14 | // custom pattern 15 | 16 | StatusLight.blinkPattern( (byte) 5, 200UL ); 17 | 18 | } 19 | 20 | void loop() { 21 | StatusLight.update(); 22 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_custom/.svn/text-base/blink_custom.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink a custom pattern indicated by a binary number 9 | // Bits a read from right to left 10 | // 0B0101UL indicates On, Off, On, Off (in that order) 11 | // Each bit represents 200ms of time 12 | // The pattern length is 4 bits 13 | // 14 | // Note the UL on the pattern to cast it as a unsigned long 15 | // This is required because of a similar call which takes a byte argument 16 | StatusLight.blinkPattern( 0B0101UL, 200, 4 ); 17 | } 18 | 19 | void loop() { 20 | StatusLight.update(); 21 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_sos/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_sos 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_sos.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 82b8e149eb55629060fd89830c4a3728 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 368 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_basic 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_basic.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | afec082c3380bb91e546576da41c4092 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 330 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_easy/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_easy 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_easy.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 5aaa73d196d711db2c1b9305ab018954 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 485 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_fade/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_fade 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_fade.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | df9d104392550ff10ae89763cd9e00b3 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 807 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_basic2/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_basic2 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_basic2.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 3d3f07353fcaadc530bebd7ba9aeace5 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 320 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_custom/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_custom 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_custom.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 571ec20f2e91c40ddbea8902455c6a14 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 580 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_faster/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED/examples/blink_faster 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | blink_faster.pde 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 453f6be8dd5f23eabecb8f60167b9e49 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 593 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_faster/.svn/text-base/blink_faster.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 13 (with default settings - no PWM) 4 | SyncLED StatusLight(13); 5 | 6 | void setup() { 7 | 8 | // Blink the LED 5 times with a duration of 200ms between blinks 9 | // and an automatic 4 x Duration (800 milliseconds) delay between series of blinks 10 | // 11 | // This is useful for setting a simple blink status code 12 | // If you do not want the pause between series, please see the 13 | // examples/blink_custom and examples/blink_basic2 to setup a repeating 14 | // custom pattern 15 | 16 | StatusLight.blinkPattern( (byte) 5, 200UL ); 17 | 18 | } 19 | 20 | void loop() { 21 | StatusLight.update(); 22 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_fade/blink_fade.pde: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 3 (pwm) 4 | // Initial state is LOW (off) 5 | // Use PWM is true (LED will fade between states - works only on PWMable pins) 6 | // fade time is 200ms - it will take that long to fully fade in or out 7 | SyncLED StatusLight(3, LOW, true, 200UL); 8 | 9 | void setup() { 10 | 11 | // Blink the LED 5 times with a duration of 200ms between blinks 12 | // and an automatic 4 x Duration (800 milliseconds) delay between series of blinks 13 | // 14 | // Note that 500ms rate allows for 200ms of PWM fade time and 300ms of on or off time 15 | // If it were less than 200ms, the LED would not reach full brightness before jumping 16 | // to full brightness to fade out from 100% since fadeout begins at 100% duty 17 | // 18 | StatusLight.blinkPattern( (byte) 5, 500UL ); 19 | 20 | } 21 | 22 | void loop() { 23 | StatusLight.update(); 24 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/examples/blink_fade/.svn/text-base/blink_fade.pde.svn-base: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | // Create an LED instance on pin 3 (pwm) 4 | // Initial state is LOW (off) 5 | // Use PWM is true (LED will fade between states - works only on PWMable pins) 6 | // fade time is 200ms - it will take that long to fully fade in or out 7 | SyncLED StatusLight(3, LOW, true, 200UL); 8 | 9 | void setup() { 10 | 11 | // Blink the LED 5 times with a duration of 200ms between blinks 12 | // and an automatic 4 x Duration (800 milliseconds) delay between series of blinks 13 | // 14 | // Note that 500ms rate allows for 200ms of PWM fade time and 300ms of on or off time 15 | // If it were less than 200ms, the LED would not reach full brightness before jumping 16 | // to full brightness to fade out from 100% since fadeout begins at 100% duty 17 | // 18 | StatusLight.blinkPattern( (byte) 5, 500UL ); 19 | 20 | } 21 | 22 | void loop() { 23 | StatusLight.update(); 24 | } -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex02_Toggle/FancyLED_Ex02_Toggle.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 2 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - Extra LED on pin 9 8 | * 9 | * Behavior: 10 | * 11 | * Created 4 April 2010 12 | * Updated 29 October 2010 13 | * by Carlyn Maw 14 | * 15 | */ 16 | 17 | #include 18 | #include 19 | 20 | //Instantiate Button on digital pin 2 21 | //pressed = ground (i.e. pulled high with external resistor) 22 | Button helloButton = Button(2, LOW); 23 | 24 | FancyLED externalLED = FancyLED(9, HIGH); 25 | FancyLED boardLED = FancyLED(13, HIGH); 26 | 27 | void setup() 28 | { 29 | externalLED.turnOn(); 30 | boardLED.turnOff(); 31 | 32 | } 33 | 34 | void loop() 35 | { 36 | 37 | helloButton.listen(); 38 | 39 | 40 | if (helloButton.onPress()) { 41 | externalLED.toggle(); 42 | boardLED.toggle(); 43 | } 44 | 45 | } 46 | 47 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/config.default.h: -------------------------------------------------------------------------------- 1 | /* 2 | Configuration example 3 | Rename me to "config_CUSTOM.h" 4 | and include me from Serial2Net_ESP8266.ino 5 | */ 6 | 7 | //#define USE_WDT 8 | 9 | // IP Address ------------------------------------------------------------------ 10 | #define STATIC_IP // comment to enable DHCP 11 | 12 | #ifdef STATIC_IP 13 | #define IP_ADDRESS "10.1.7.41" 14 | #define GATEWAY_ADDRESS "10.1.11.1" 15 | #define NET_MASK "255.255.0.0" 16 | #endif 17 | 18 | // Wifi credentials ------------------------------------------------------------ 19 | #define WIFI_SSID "SSID_NAME" 20 | #define WIFI_PASSWORD "Your_SSID_Password" 21 | 22 | // Server / Client Settings ---------------------------------------------------- 23 | #define TCP_LISTEN_PORT 9999 24 | #define BAUD_RATE 57600 //RFLink default speed 25 | #define BUFFER_SIZE 128 // serial end ethernet buffer size 26 | 27 | // PINS ------------------------------------------------------------------------ 28 | #define WIFI_LED 16 29 | #define CONNECTION_LED 14 30 | #define TX_LED 12 31 | #define RX_LED 13 32 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/keywords.txt: -------------------------------------------------------------------------------- 1 | ####################################### 2 | # Syntax Coloring Map For FancyLED 3 | ####################################### 4 | 5 | ####################################### 6 | # Datatypes (KEYWORD1) 7 | ####################################### 8 | 9 | FancyLED KEYWORD1 10 | 11 | ####################################### 12 | # Methods and Functions ( KEYWORD2) 13 | ####################################### 14 | 15 | update KEYWORD2 16 | getState KEYWORD2 17 | 18 | turnOn KEYWORD2 19 | turnOff KEYWORD2 20 | toggle KEYWORD2 21 | 22 | pulse KEYWORD2 23 | fusedPulse KEYWORD2 24 | getDutyCycle KEYWORD2 25 | setDutyCycle KEYWORD2 26 | getFullPeriod KEYWORD2 27 | setFullPeriod KEYWORD2 28 | 29 | 30 | ###################################### 31 | # Instances (KEYWORD2) 32 | ####################################### 33 | 34 | 35 | ####################################### 36 | # Constants (LITERAL1) 37 | ####################################### 38 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex01_OnAndOff/FancyLED_Ex01_OnAndOff.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 1 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - Extra LED on pin 9 8 | * 9 | * Behavior: 10 | * Two LED's when one is on, the other is off - based on button 11 | * state. 12 | * 13 | * Created 4 April 2010 14 | * Updated 17 August 2011 15 | * by Carlyn Maw 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | //Instantiate Button on digital pin 2 23 | //pressed = ground (i.e. pulled high with external resistor) 24 | Button helloButton = Button(2, LOW); 25 | 26 | FancyLED externalLED = FancyLED(9, HIGH); 27 | FancyLED boardLED = FancyLED(13, HIGH); 28 | 29 | void setup() 30 | { 31 | 32 | 33 | } 34 | 35 | void loop() 36 | { 37 | 38 | helloButton.listen(); 39 | 40 | 41 | if (helloButton.isPressed()) { 42 | externalLED.turnOn(); 43 | boardLED.turnOff(); 44 | } 45 | 46 | 47 | if (helloButton.isReleased()) { 48 | externalLED.turnOff(); 49 | boardLED.turnOn(); 50 | 51 | } 52 | 53 | } 54 | 55 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Serial2Net ESP8266 2 | 3 | This ESP8266 based project is a bridge which allows to send/receive the TX/RX Serial port of any device (ie another arduino) to the LAN, using the ESP8266 Wifi connection. I use it mainly to connect RFLink to my LAN, but it could be used whenever you need a "Ser2net" LAN connection. 4 | 5 | 6 | ## Features 7 | 8 | - Supports 4 (or more) LAN clients 9 | - 4 Status Leds (Wifi State, Number of Clients Connected, TX, RX) 10 | - The "Clients Connected" Led blinks the time of clients count. 11 | 12 | 13 | ## Schematic 14 | ![schematic](images/schematic.png) 15 | 16 | 17 | ## Wiring 18 | ![wiring](images/wiring.png) 19 | 20 | 21 | ## License 22 | 23 | This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. 24 | 25 | This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 26 | 27 | You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 28 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/.svn/entries: -------------------------------------------------------------------------------- 1 | 10 2 | 3 | dir 4 | 2 5 | http://arduino-library-syncled.googlecode.com/svn/trunk/SyncLED 6 | http://arduino-library-syncled.googlecode.com/svn 7 | 8 | 9 | 10 | 2011-09-23T21:09:23.361560Z 11 | 2 12 | okachobi@gmail.com 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 62fe76ca-8c73-f804-774b-a94f392fa45f 28 | 29 | SyncLED.cpp 30 | file 31 | 32 | 33 | 34 | 35 | 2014-10-08T12:13:49.000000Z 36 | 1c1639663797388e8132ad5cb17afb33 37 | 2011-09-23T21:09:23.361560Z 38 | 2 39 | okachobi@gmail.com 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 2407 62 | 63 | SyncLED.h 64 | file 65 | 66 | 67 | 68 | 69 | 2014-10-08T12:13:49.000000Z 70 | d2a5517b9273b13a69db5c823cd9dcb1 71 | 2011-09-23T21:09:23.361560Z 72 | 2 73 | okachobi@gmail.com 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 1327 96 | 97 | documentation.txt 98 | file 99 | 100 | 101 | 102 | 103 | 2014-10-08T12:13:49.000000Z 104 | fa5a0a53de3bca88b83b4cb9f578992b 105 | 2011-09-23T21:09:23.361560Z 106 | 2 107 | okachobi@gmail.com 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 220 130 | 131 | examples 132 | dir 133 | 134 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex04_Blink_N_Times_With_Delayed_Start/FancyLED_Ex04_Blink_N_Times_With_Delayed_Start.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 4 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - Extra LED on pin 9 8 | * 9 | * Behavior: 10 | * External LED blinks twice. LED on the board blinks twice 5 11 | * seconds later. 12 | * 13 | * Created 17 August 2011 14 | * by Carlyn Maw 15 | * 16 | */ 17 | 18 | #include 19 | #include 20 | 21 | unsigned long loopCurrentTime = 0; 22 | 23 | //Instantiate Button on digital pin 2 24 | //pressed = ground (pulled high with _external_ resistor) 25 | Button helloButton = Button(2, LOW); 26 | 27 | //Instantiate FancySolenoid on digital pin 5 28 | //active = HIGH (could need to be low if inverting IC is being used...) 29 | FancyLED externalLED = FancyLED(9, LOW); 30 | FancyLED boardLED = FancyLED(13, LOW); 31 | 32 | 33 | void setup() 34 | { 35 | Serial.begin(19200); 36 | externalLED.setFullPeriod(1000); 37 | externalLED.setDutyCycle(50); 38 | externalLED.turnOff(); 39 | 40 | boardLED.setFullPeriod(1000); 41 | boardLED.setDutyCycle(50); 42 | boardLED.turnOff(); 43 | 44 | } 45 | 46 | void loop() 47 | { 48 | 49 | helloButton.listen(); 50 | externalLED.update(); 51 | boardLED.update(); 52 | 53 | 54 | if (helloButton.onPress()) { 55 | 56 | externalLED.pulse(1); 57 | boardLED.fusedPulse(5000,1); 58 | 59 | } 60 | 61 | } 62 | 63 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/.svn/text-base/SyncLED.h.svn-base: -------------------------------------------------------------------------------- 1 | #ifndef _SYNCLED_H_ 2 | #define _SYNCLED_H_ 3 | #include 4 | 5 | class SyncLED { 6 | 7 | public: 8 | SyncLED(byte pin, byte initialState = LOW, boolean usePWM = false, unsigned long pwmMS = 500); 9 | 10 | // Set the pattern (if desired) in binary ex: 0B1000010001 11 | // Note that the max length is 32 bits... 12 | // Rate represents the delay between bits 13 | void blinkPattern(unsigned long pattern = 0B10101010101010101010101010101010, unsigned long delay = 1000, byte pattern_length = 32); 14 | void setRate(unsigned long delay); 15 | void setPattern(unsigned long pattern, byte pattern_length = 32); 16 | void blinkPattern(uint8_t blinks, unsigned long delay = 1000); 17 | 18 | // The following functions stop the current pattern 19 | // and set the LED state explicitly 20 | void On(); 21 | void Off(); 22 | 23 | // Resume pattern once stopped 24 | void resumePattern(boolean reset = false); 25 | 26 | // Return true if the light is currently on 27 | boolean isOn(); 28 | 29 | // Call one of these to update LED State 30 | void update(); 31 | void update(unsigned long time_ms); 32 | 33 | private: // methods 34 | void advanceState(unsigned long time_ms); 35 | 36 | private: // variables 37 | byte m_pin; 38 | unsigned long m_pattern; 39 | unsigned long m_delay; 40 | unsigned long m_lastChange; 41 | unsigned long m_pwmFadeMS; 42 | byte m_patternLength; 43 | byte m_inPattern; 44 | byte m_patternPosition; 45 | byte m_state; 46 | byte m_lastState; 47 | byte m_usePWM; 48 | 49 | }; 50 | 51 | #endif 52 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/test_leds.ino.txt: -------------------------------------------------------------------------------- 1 | /* 2 | 3 | Rename me to .ino and upload me to the ESP8266 to test the Led Pins 4 | 5 | */ 6 | 7 | // Config ##################################################################### 8 | 9 | #include "config_CUSTOM.h" 10 | //#include "config_315.h" 11 | //#include "config_433.h" 12 | 13 | //FancyLED led_tx = FancyLED(RX_LED, HIGH); 14 | //FancyLED led_rx = FancyLED(TX_LED, HIGH); 15 | //FancyLED led_wifi = FancyLED(WIFI_LED, HIGH); 16 | //FancyLED led_connect= FancyLED(CONNECTION_LED, HIGH); 17 | 18 | // ----------------------------------------------------------------------------- 19 | void setup(void){ 20 | digitalWrite(WIFI_LED, LOW); 21 | digitalWrite(CONNECTION_LED, LOW); 22 | digitalWrite(TX_LED, LOW); 23 | digitalWrite(RX_LED, LOW); 24 | 25 | pinMode(WIFI_LED, OUTPUT); 26 | pinMode(CONNECTION_LED, OUTPUT); 27 | pinMode(TX_LED, OUTPUT); 28 | pinMode(RX_LED, OUTPUT); 29 | 30 | Serial.begin(BAUD_RATE); 31 | } 32 | 33 | 34 | // ----------------------------------------------------------------------------- 35 | void loop(void){ 36 | TestLed(WIFI_LED, "WIFI_LED"); 37 | TestLed(CONNECTION_LED, "CONNECTION_LED"); 38 | TestLed(TX_LED, "TX_LED"); 39 | TestLed(RX_LED, "RX_LED"); 40 | } 41 | 42 | 43 | // ----------------------------------------------------------------------------- 44 | void TestLed(int pin, String name){ 45 | Serial.print("Led '"); 46 | Serial.print(name); 47 | Serial.print("' on Pin "); 48 | Serial.println(pin); 49 | digitalWrite(pin, HIGH); 50 | delay(2000); 51 | digitalWrite(pin, LOW); 52 | delay(500); 53 | } 54 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/SyncLED/SyncLED.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef _SYNCLED_H_ 3 | #define _SYNCLED_H_ 4 | 5 | #if ARDUINO >= 100 6 | #include "Arduino.h" 7 | #else 8 | #include "WProgram.h" 9 | #endif 10 | 11 | class SyncLED 12 | { 13 | public: 14 | SyncLED(byte pin, byte initialState = LOW, boolean usePWM = false, unsigned long pwmMS = 500); 15 | 16 | // Set the pattern (if desired) in binary ex: 0B1000010001 17 | // Note that the max length is 32 bits... 18 | // Rate represents the delay between bits 19 | void blinkPattern(unsigned long pattern = 0B10101010101010101010101010101010, unsigned long delay = 1000, byte pattern_length = 32); 20 | void setRate(unsigned long delay); 21 | void setPattern(unsigned long pattern, byte pattern_length = 32); 22 | void blinkPattern(uint8_t blinks, unsigned long delay = 1000); 23 | 24 | // The following functions stop the current pattern 25 | // and set the LED state explicitly 26 | void On(); 27 | void Off(); 28 | 29 | // Resume pattern once stopped 30 | void resumePattern(boolean reset = false); 31 | 32 | // Return true if the light is currently on 33 | boolean isOn(); 34 | 35 | // Call one of these to update LED State 36 | void update(); 37 | void update(unsigned long time_ms); 38 | 39 | private: // methods 40 | void advanceState(unsigned long time_ms); 41 | 42 | private: // variables 43 | byte m_pin; 44 | unsigned long m_pattern; 45 | unsigned long m_delay; 46 | unsigned long m_lastChange; 47 | unsigned long m_pwmFadeMS; 48 | byte m_patternLength; 49 | byte m_inPattern; 50 | byte m_patternPosition; 51 | byte m_state; 52 | byte m_lastState; 53 | byte m_usePWM; 54 | 55 | }; 56 | 57 | #endif 58 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex03_Blink_N_Times/FancyLED_Ex03_Blink_N_Times.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 3 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - Extra LED on pin 9 8 | * 9 | * Behavior: 10 | * LED blinks 5 times after button is pressed. Can set and get 11 | * timing variables. 12 | * 13 | * Created 4 April 2010 14 | * Updated 17 August 2011 15 | * by Carlyn Maw 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | unsigned long loopCurrentTime = 0; 23 | 24 | //Instantiate Button on digital pin 2 25 | //pressed = ground (pulled high with _external_ resistor) 26 | Button helloButton = Button(2, LOW); 27 | 28 | //Instantiate FancyLED on digital pin 9 29 | //active = HIGH (could need to be low if inverting IC is being used...) 30 | FancyLED externalLED = FancyLED(9, HIGH); 31 | 32 | 33 | void setup() 34 | { 35 | Serial.begin(9600); 36 | externalLED.setFullPeriod(1000); 37 | externalLED.setDutyCycle(10); 38 | 39 | } 40 | 41 | void loop() 42 | { 43 | 44 | helloButton.listen(); 45 | externalLED.update(); 46 | 47 | if (helloButton.onPress()) { 48 | //will blink the LED once at current period length and duty cycle 49 | // externalLED.pulse(); 50 | 51 | //will blink the LED 5 times at current period length and duty cycle 52 | externalLED.pulse(5); 53 | 54 | //will pulse 5 times and update period lenth and duty settings 55 | //externalLED.pulse(5, 2000, 10); 56 | 57 | //can set period length and duty cycle seperately 58 | //externalLED.setFullPeriod(2000); 59 | //externalLED.setDutyCycle(10); 60 | 61 | Serial.println(externalLED.getFullPeriod()); 62 | Serial.println(externalLED.getDutyCycle()); 63 | } 64 | 65 | } 66 | 67 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/FancyLED.h: -------------------------------------------------------------------------------- 1 | /* 2 | FancyLED.h - - FancyLED library for Wiring/Arduino - Version 0.1.1 3 | 4 | Original library (0.1) by Carlyn Maw. 5 | 6 | */ 7 | 8 | // ensure this library description is only included once 9 | #ifndef FancyLED_h 10 | #define FancyLED_h 11 | 12 | // include types & constants of Wiring core API 13 | #if defined(ARDUINO) && ARDUINO >= 100 14 | #include "Arduino.h" 15 | #else 16 | #include "WProgram.h" 17 | #endif 18 | 19 | // library interface description 20 | class FancyLED { 21 | 22 | // user-accessible "public" interface 23 | public: 24 | // constructors: 25 | FancyLED(int myPin, bool myMode); 26 | FancyLED(int myBit, bool myMode, unsigned char *myRegister); 27 | 28 | //char* version(void); // get the library version 29 | //unsigned char getRegisterValue(void); 30 | 31 | void setCurrentTime(unsigned long); 32 | void update(unsigned long); 33 | void update(void); 34 | 35 | int getState(void); 36 | 37 | void turnOn(void); 38 | void turnOff(void); 39 | void toggle(void); 40 | 41 | void pulse(int); 42 | void pulse(int, int, int); 43 | void pulse(void); 44 | 45 | void fusedPulse(long myFuseLength, int myPulseTimes); 46 | 47 | int getDutyCycle(void); 48 | void setDutyCycle(int); 49 | 50 | long getFullPeriod(void); 51 | void setFullPeriod(long); 52 | 53 | 54 | 55 | 56 | // library-accessible "private" interface 57 | private: 58 | int _myPin; 59 | int _myBit; 60 | unsigned char *_myRegister; 61 | unsigned char _registerValue; 62 | bool _type; //direct pin or shift register 63 | bool _mode; //HIGH == pressed (1) or LOW == pressed (0) 64 | 65 | int _lastState; 66 | int _currentState; 67 | bool _pinState; 68 | 69 | long _fuseTimer; 70 | 71 | int _onPeriod; 72 | int _offPeriod; 73 | int _dutyCycle; 74 | long _fullPeriod; 75 | //long _longHolder; 76 | 77 | bool _pulseFlag; 78 | 79 | unsigned long int _flipTime; 80 | unsigned long int _currentTime; 81 | 82 | int _currentPulseCount; 83 | int _goalPulseCount; 84 | 85 | 86 | void updatePin(bool); 87 | 88 | }; 89 | 90 | #endif 91 | 92 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex06_EightLEDs/FancyLED_Ex06_EightLEDs.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 5 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - LEDs on Pins 2 through 9 (only the one on 9 is really used) 8 | * 9 | * Behavior: 10 | * Showing the potential for this lbrary to work with register 11 | * bytes. With multiple LEDs. Don't have to use the register-style 12 | * instantiation to make multiples, btw. 13 | * 14 | * Created 10 July 2011 15 | * by Carlyn Maw 16 | * 17 | */ 18 | 19 | #include 20 | #include 21 | 22 | bool debugFlag = 0; 23 | unsigned long currentTime = 0; 24 | 25 | const byte numberOfblinkers = 8; 26 | byte blinkPinArray[numberOfblinkers] = { 27 | 2, 3,4 ,5 ,6, 7, 8,9 } 28 | ; 29 | 30 | //the pit array of the pinstates for the blinkers 31 | unsigned char blinkMe = 0; 32 | //Instantiate Button on digital pin 2 33 | //pressed = ground (pulled high with _external_ resistor) 34 | Button helloButton = Button(2, LOW); 35 | 36 | FancyLED solenoids[numberOfblinkers] = { 37 | FancyLED(0, HIGH, &blinkMe), 38 | FancyLED(1, HIGH, &blinkMe), 39 | FancyLED(2, HIGH, &blinkMe), 40 | FancyLED(3, HIGH, &blinkMe), 41 | FancyLED(4, HIGH, &blinkMe), 42 | FancyLED(5, HIGH, &blinkMe), 43 | FancyLED(6, HIGH, &blinkMe), 44 | FancyLED(7, HIGH, &blinkMe) 45 | }; 46 | 47 | 48 | void setup() 49 | { 50 | Serial.begin(9600); 51 | 52 | 53 | //have to do outputs b/c using the solenoid register style 54 | for (byte i = 0; i < numberOfblinkers; i ++) { 55 | pinMode(blinkPinArray[i], OUTPUT); 56 | } 57 | 58 | 59 | } 60 | 61 | void loop() 62 | { 63 | 64 | helloButton.listen(); 65 | 66 | currentTime = millis(); 67 | 68 | for (byte i = 0; i < numberOfblinkers; i ++) { 69 | solenoids[i].update(currentTime); 70 | } 71 | 72 | 73 | if (helloButton.onPress()) { 74 | 75 | for (byte i = 0; i < numberOfblinkers; i ++) { 76 | solenoids[i].pulse(5); 77 | } 78 | 79 | } 80 | 81 | blinkOut(blinkMe); 82 | } 83 | 84 | 85 | void blinkOut(byte myDataOut) { 86 | int pinState; 87 | for (int t=7; t>=0; t--) { 88 | if ( myDataOut & (1<= m_delay) { 97 | // Time to change LED state 98 | // Get the next bit out of the pattern 99 | advanceState(time_ms); 100 | 101 | // m_state ^= 1UL; 102 | digitalWrite( m_pin, m_state ); 103 | } 104 | } else { // Use PWM 105 | if(surpassed >= m_delay) { 106 | advanceState(time_ms); 107 | } 108 | 109 | // Progressive change 110 | // Map our current value and write it out - no 111 | if(m_lastState != m_state) 112 | analogWrite(m_pin, constrain( map( surpassed, 0, m_pwmFadeMS, (m_state?0:255), (m_state?255:0)), 0, 255)); 113 | } 114 | 115 | } 116 | 117 | 118 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/examples/FancyLED_Ex05_AsRegisterBit/FancyLED_Ex05_AsRegisterBit.pde: -------------------------------------------------------------------------------- 1 | /* 2 | * FancyLED Library Example 5 3 | * ------------ 4 | * 5 | * Circuit: 6 | * - Button, pulled up externally with 10k resitor on pin 2 7 | * - LEDs on Pins 2 through 9 (only the one on 9 is really used) 8 | * 9 | * Behavior: 10 | * Showing the potential for this lbrary to work with register 11 | * bytes. Acts just like example 3. 12 | * Hook up all the LEDs and Change the value of blinkMe. 13 | * See what changes. 14 | * 15 | * Created 10 July 2011 16 | * by Carlyn Maw 17 | * 18 | */ 19 | 20 | #include 21 | #include 22 | 23 | bool debugFlag = 0; 24 | 25 | const byte numberOfblinkers = 8; 26 | byte blinkPinArray[numberOfblinkers] = { 27 | 2,3,4,5,6, 7, 8,9 } 28 | ; 29 | 30 | //the byte that acts as an array of the pinstates for 31 | //the blinkers, could be a byte to be shifted out to shift 32 | //register, etc. 33 | unsigned char blinkMe = 0; 34 | 35 | //Instantiate Button on digital pin 2 36 | //pressed = ground (pulled high with _external_ resistor) 37 | Button helloButton = Button(2, LOW); 38 | 39 | //Instantiate FancyLED on digital pin 9 40 | //active = HIGH (could need to be low if inverting IC is being used...) 41 | //since blinkPinArray[3] is PIN 5 in this instantiation style 42 | //we use 3 ("third bit in register") 43 | FancyLED testLED = FancyLED(7, HIGH, &blinkMe); 44 | 45 | 46 | void setup() 47 | { 48 | Serial.begin(9600); 49 | testLED.setFullPeriod(1000); 50 | testLED.setDutyCycle(40); 51 | 52 | //have to do outputs b/c using the solenoid register style 53 | for (byte i = 0; i <= numberOfblinkers; i ++) { 54 | pinMode(blinkPinArray[i], OUTPUT); 55 | } 56 | 57 | 58 | } 59 | 60 | void loop() 61 | { 62 | 63 | helloButton.listen(); 64 | testLED.update(); 65 | 66 | if (helloButton.onPress()) { 67 | //will pulse once at current duty cycle and period settings 68 | // testLED.pulse(); 69 | 70 | //will pulse 5 times at current duty cycle and period settings 71 | testLED.pulse(5); 72 | 73 | //will pulse once and update duty cycle and period settings 74 | //testLED.pulse(2000, 10); 75 | 76 | //will pulse 5 times and update duty cycle and period settings 77 | //testLED.pulse(5, 2000, 10); 78 | 79 | 80 | Serial.println(testLED.getFullPeriod()); 81 | Serial.println(testLED.getDutyCycle()); 82 | } 83 | 84 | //normally you'd be shifting out if you were 85 | //using this version of the FancyLED or something. 86 | blinkOut(blinkMe); 87 | 88 | } 89 | 90 | //normally you'd be shifting out if you were 91 | //using this version of the FancyLED 92 | void blinkOut(byte myDataOut) { 93 | int pinState; 94 | for (int t=7; t>=0; t--) { 95 | if ( myDataOut & (1<= 100 2 | #include "Arduino.h" 3 | #else 4 | #include "WProgram.h" 5 | #endif 6 | 7 | #include "SyncLED.h" 8 | 9 | SyncLED::SyncLED(byte pin, byte initialState, boolean usePWM, unsigned long pwmMS):m_pin(pin),m_state(initialState), 10 | m_inPattern(false),m_lastChange(0L), m_usePWM(usePWM), m_pwmFadeMS(pwmMS) 11 | { 12 | pinMode(pin, OUTPUT); 13 | digitalWrite(pin, initialState); 14 | m_state = initialState; 15 | } 16 | 17 | void SyncLED::blinkPattern(unsigned long pattern, unsigned long delay, byte pattern_length) 18 | { 19 | setRate(delay); 20 | setPattern(pattern, pattern_length); 21 | } 22 | 23 | void SyncLED::setRate(unsigned long delay) 24 | { 25 | m_delay = delay; 26 | } 27 | 28 | void SyncLED::setPattern(unsigned long pattern, byte pattern_length) 29 | { 30 | m_pattern = pattern; 31 | m_patternLength = pattern_length; 32 | m_inPattern = true; 33 | m_patternPosition = 0; 34 | } 35 | 36 | // 37 | // Blink the LED x times 38 | // with a delay between blinks and a 4x off period between 39 | // series of blinks 40 | // 41 | void SyncLED::blinkPattern(uint8_t blinks, unsigned long delay) 42 | { 43 | m_pattern = 0; 44 | for(int i=0; i < blinks;i++) { 45 | m_pattern |= (0b10000 << (i*2)); 46 | } 47 | m_patternLength = (blinks*2) + 4; 48 | m_delay = delay; 49 | m_inPattern = true; 50 | m_patternPosition = 3; 51 | } 52 | 53 | 54 | void SyncLED::On() 55 | { 56 | m_state = HIGH; 57 | digitalWrite(m_pin, m_state); 58 | m_inPattern = false; 59 | m_lastChange = millis(); 60 | } 61 | 62 | void SyncLED::Off() 63 | { 64 | m_state = LOW; 65 | digitalWrite(m_pin, m_state); 66 | m_inPattern = false; 67 | m_lastChange = millis(); 68 | } 69 | 70 | void SyncLED::resumePattern(boolean reset) 71 | { 72 | if(reset) m_patternPosition = 0; 73 | m_inPattern = true; 74 | } 75 | 76 | boolean SyncLED::isOn() 77 | { 78 | return( m_state == HIGH ); 79 | } 80 | 81 | void SyncLED::update() 82 | { 83 | update(millis()); 84 | } 85 | 86 | void SyncLED::advanceState(unsigned long time_ms) 87 | { 88 | m_patternPosition++; 89 | m_patternPosition %= m_patternLength; 90 | m_lastState = m_state; 91 | m_state = bitRead(m_pattern, m_patternPosition); 92 | m_lastChange = time_ms; 93 | } 94 | 95 | void SyncLED::update(unsigned long time_ms) 96 | { 97 | if(!m_inPattern) return; 98 | 99 | unsigned long surpassed = time_ms - m_lastChange; 100 | 101 | if(!m_usePWM) { // Simple state changes... 102 | if(surpassed >= m_delay) { 103 | // Time to change LED state 104 | // Get the next bit out of the pattern 105 | advanceState(time_ms); 106 | 107 | // m_state ^= 1UL; 108 | digitalWrite( m_pin, m_state ); 109 | } 110 | } else { // Use PWM 111 | if(surpassed >= m_delay) { 112 | advanceState(time_ms); 113 | } 114 | 115 | // Progressive change 116 | // Map our current value and write it out - no 117 | if(m_lastState != m_state) 118 | analogWrite(m_pin, constrain( map( surpassed, 0, m_pwmFadeMS, (m_state?0:255), (m_state?255:0)), 0, 255)); 119 | } 120 | 121 | } 122 | 123 | 124 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/README.txt: -------------------------------------------------------------------------------- 1 | This is an example C++ library for Arduino 0018+, by Carlyn Maw 2 | 3 | Installation 4 | -------------------------------------------------------------------------------- 5 | 6 | To install this library, just place this entire folder as a subfolder in your 7 | ~/Documents/Arduino/libraries folder for mac My Documents\Arduino\libraries\ for a 8 | PC. 9 | 10 | When installed, this library should look like: 11 | 12 | Arduino/libraries/FancyLED (this library's folder) 13 | Arduino/libraries/FancyLED/FancyLED.cpp (the library implementation file) 14 | Arduino/libraries/FancyLED/FancyLED.h (the library description file) 15 | Arduino/libraries/FancyLED/keywords.txt (the syntax coloring file) 16 | Arduino/libraries/FancyLED/examples (the examples in the "open" menu) 17 | Arduino/libraries/FancyLED/readme.txt (this file) 18 | 19 | Building 20 | -------------------------------------------------------------------------------- 21 | 22 | After this library is installed, you just have to start the Arduino application. 23 | You may see a few warning messages as it's built. 24 | 25 | To use this library in a sketch, go to the Sketch | Import Library menu and 26 | select dLED. This will add a corresponding line to the top of your sketch: 27 | #include 28 | 29 | To stop using this library, delete that line from your sketch. 30 | 31 | Geeky information: 32 | After a successful build of this library, a new file named "FancyLED.o" will appear 33 | in "Arduino/libraries/FancyLED". This file is the built/compiled library 34 | code. 35 | 36 | If you choose to modify the code for this library (i.e. "FancyLED.cpp" or "FancyLED.h"), 37 | then you must first 'unbuild' this library by deleting the "FancyLED.o" file. The 38 | new "FancyLED.o" with your code will appear after the next press of "verify" 39 | 40 | Public Functions 41 | -------------------------------------------------------------------------------- 42 | 43 | FancyLED myInstance = FancyLED(int myPin, bool myMode); 44 | 45 | FancyLED myInstance = FancyLED(int pinNumber, bool pressedState); 46 | 47 | myInstance = some name 48 | myPin = some int representing what pin the LED is attached to 49 | myMode = is the pin meant to be HIGH or LOW when to turn the LED on (power source or power sink?) 50 | 51 | BEHAVIOR: creates instance of a FancyLED 52 | 53 | FancyLED myInstance = FancyLED(int pinNumber, bool pressedState, unsigned char *myRegister); 54 | 55 | myInstance = some name 56 | myBit = some int representing in what bit the LED information is stored 57 | myMode = is the pin meant to be HIGH or LOW when to turn the LED on (power source or power sink?) 58 | *myRegister = the byte containing the button information passed by reference ( &byteName ) 59 | 60 | BEHAVIOR: creates instance of a FancyLED 61 | 62 | myInstance.update(); 63 | myInstance.update(unsigned long newCurrentTime); 64 | 65 | newCurrentTime = optional value if you want all the LEDs have same preicisesly the same update 66 | time. Calling this function without providing a specific time causes it to call millis() itself. 67 | 68 | BEHAVIOR: Does all the work of the function, actually tracks the behavior. Should be called 69 | at the top of the main loop. 70 | 71 | 72 | myInstance.setCurrentTime(unsigned long newCurrentTime); 73 | 74 | newCurrentTime = forces a refresh of the private current time variable. Shouldn't be necessary. 75 | 76 | BEHAVIOR: returns true if the debounced value for button is unpressed. 77 | 78 | myInstance.getState(); 79 | 80 | BEHAVIOR: returns true a value 81 | 0 - off, available to get new messages 82 | 1 - on 83 | 2 - off, but in a forced resting mode (the off part of a duty cycle, for example) 84 | 85 | 86 | myInstance.turnOn(); 87 | 88 | BEHAVIOR: Turns it on. (state goes to 1, led turns on) 89 | 90 | myInstance.turnOff(); 91 | 92 | BEHAVIOR: Turns it off. (state goes to 2, led turns off - state will still wait go to 0 until 93 | the off period determined my the period length and duty cycle is over) 94 | 95 | myInstance.toggle(); 96 | 97 | BEHAVIOR: If it is on, it goes off. If it is either off or resting it goes on. 98 | 99 | myInstance.pulse(char myPulseTimes); 100 | myInstance.pulse(char myPulseTimes, int myPeriod, int myDutyCycle) 101 | 102 | myPulseTimes = the number of times you want it to blink 103 | myPeriod = the length of the full cycle 104 | myDutyCycle = the percent of that period that the LED will be on (at the start) 105 | 106 | BEHAVIOR: LED will blink the number of times asked of it, at the default/current settings unless 107 | they are also updated. 108 | 109 | myInstance.pulse(); 110 | 111 | BEHAVIOR: This function will pulse the LED forever (if myInstance.update() is called) 112 | 113 | myInstance.fusedPulse(long myFuseLength, int myPulseTimes); 114 | 115 | myFuseLength = how long will it wait until it starts the pulse routine 116 | myPulesTimes = the number of times it will pulse 117 | 118 | BEHAVIOR: pulses the number of time indicated by myPulseTimes, but delays start for the number 119 | of milliseconds indicated by myFuseLength 120 | 121 | myInstance.getDutyCycle(); 122 | 123 | BEHAVIOR: returns current value of the duty cycle 124 | 125 | myInstance.setDutyCycle(int newDC); 126 | 127 | newDC = new value for duty cycle (percentage of period, value 0-100) 128 | 129 | BEHAVIOR: sets the value for the duty cycle. default is 50% 130 | 131 | myInstance.getFullPeriod(); 132 | 133 | BEHAVIOR: returns the value of the full period (how long on + how long off) 134 | 135 | myInstance.setFullPeriod(long newFP); 136 | 137 | newFP = value in milliseconds that the full period should be. 138 | 139 | BEHAVIOR: sets the value for how long it takes the LED to complete a on cycle and an off cycle. 140 | Default is 1000 (1 second). 141 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/lib/FancyLED/FancyLED.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | FancyLED.h - FancyLED for Wiring/Arduino 3 | (cc) 2011 Carlyn Maw, Attribute, Share Alike 4 | 5 | Created 06 July 2011 6 | Version 0.1.1 7 | */ 8 | 9 | 10 | // include core Wiring API 11 | #if defined(ARDUINO) && ARDUINO >= 100 12 | #include "Arduino.h" 13 | #else 14 | #include "WProgram.h" 15 | #endif 16 | 17 | // include this library's description file 18 | #include "FancyLED.h" 19 | 20 | 21 | 22 | // Constructor ///////////////////////////////////////////////////////////////// 23 | // Function that handles the creation and setup of instances 24 | 25 | //------------------------------------------------------ Using Arduino Pin Num 26 | FancyLED::FancyLED(int myPin, bool myMode) 27 | { 28 | // initialize this instance's variables 29 | this->_myPin = myPin; 30 | 31 | pinMode(this->_myPin, OUTPUT); 32 | 33 | this->_type = 0; 34 | this->_myBit = this->_myPin; 35 | this->_mode = myMode; 36 | 37 | _lastState = 0; 38 | _currentState = 0; 39 | _pinState= 0; 40 | 41 | _dutyCycle = 50; 42 | _fullPeriod = 1000; 43 | _fuseTimer = 0; 44 | 45 | _goalPulseCount = 1; 46 | _currentPulseCount = 0; 47 | 48 | } 49 | 50 | //----------------------------------------------------------------- Using Byte 51 | FancyLED::FancyLED(int myBit, bool myMode, unsigned char *myRegister) 52 | { 53 | // initialize this instance's variables 54 | this->_type = 1; 55 | this->_mode = myMode; 56 | this->_myBit = myBit; 57 | this->_myPin = this->_myBit; 58 | this->_myRegister = myRegister; 59 | 60 | this->_registerValue = 255; 61 | 62 | _lastState = 0; 63 | _currentState = 0; 64 | _pinState= 0; 65 | 66 | _dutyCycle = 50; 67 | _fullPeriod = 1000; 68 | _fuseTimer = 0; 69 | 70 | _goalPulseCount = 1; 71 | _currentPulseCount = 0; 72 | } 73 | 74 | // Public Methods ////////////////////////////////////////////////////////////// 75 | // Functions available in Wiring sketches, this library, and other libraries 76 | 77 | //---------////////////////////MAIN LOOP / LISTENER ///////////--------------// 78 | 79 | void FancyLED::update(void) { 80 | update(millis()); 81 | } 82 | 83 | 84 | 85 | void FancyLED::update(unsigned long newCurrentTime) { 86 | _currentTime = newCurrentTime; 87 | 88 | 89 | if (_fuseTimer > _currentTime) { 90 | return; 91 | } 92 | 93 | if (_goalPulseCount == 0 or _currentPulseCount < _goalPulseCount) { 94 | _pulseFlag = true; 95 | } else if (_currentPulseCount >= _goalPulseCount) { 96 | } 97 | 98 | 99 | 100 | // if (_pulseFlag && _countFlag) { 101 | if (_pulseFlag) { 102 | //_longHolder = (_fullPeriod * _dutyCycle) / 100; 103 | //_onPeriod = int(_longHolder); 104 | _onPeriod = (_fullPeriod * _dutyCycle) / 100; 105 | _offPeriod = (_fullPeriod - _onPeriod); 106 | //Serial.println(_onPeriod); 107 | 108 | //if my state is ready 109 | if (_currentState == 0) { 110 | //get the time 111 | _flipTime = _currentTime; 112 | //set my state to firing 113 | _currentState = 1; 114 | //turn on the pin 115 | _pinState = _mode; 116 | updatePin(_pinState); 117 | } 118 | //if my state is firing 119 | else if (_currentState == 1) { 120 | if ((_onPeriod) < (_currentTime - _flipTime)) { 121 | //if it's time, turn me off 122 | _flipTime = _currentTime; 123 | _currentState = 2; 124 | _pinState = !_mode; 125 | updatePin(_pinState); 126 | } 127 | } 128 | //if my state is resting 129 | else if (_currentState == 2) { 130 | //keep me off 131 | _pinState = !_mode; 132 | updatePin(_pinState); 133 | //check the time and make me ready 134 | if ((_offPeriod) < (_currentTime - _flipTime)) { 135 | _currentState = 0; 136 | _currentPulseCount++; 137 | _pulseFlag = false; 138 | _flipTime = _currentTime; 139 | } 140 | 141 | } 142 | } 143 | 144 | } 145 | 146 | 147 | void FancyLED::setCurrentTime(unsigned long newCurrentTime) { 148 | _currentTime = newCurrentTime; 149 | } 150 | 151 | int FancyLED::getState(void){ 152 | return _currentState; 153 | } 154 | 155 | 156 | 157 | void FancyLED::turnOn(void){ 158 | _pinState = _mode; 159 | updatePin(_pinState); 160 | 161 | _lastState = _currentState; 162 | _currentState = 1; //firing 163 | _flipTime = _currentTime; 164 | 165 | } 166 | 167 | void FancyLED::turnOff(void){ 168 | _pinState = !_mode; 169 | updatePin(_pinState); 170 | 171 | _lastState = _currentState; 172 | _currentState = 2; //waiting 173 | 174 | } 175 | 176 | void FancyLED::toggle(void) { 177 | if (_currentState == 1) { 178 | turnOff(); 179 | } else { 180 | turnOn(); 181 | } 182 | } 183 | 184 | void FancyLED::pulse(int myPulseTimes) { 185 | 186 | _pulseFlag = true; 187 | _goalPulseCount = myPulseTimes; 188 | _currentPulseCount = 0; 189 | } 190 | 191 | void FancyLED::pulse(int myPulseTimes, int myPeriod, int myDutyCycle) { 192 | 193 | _dutyCycle = myDutyCycle; 194 | _fullPeriod = myPeriod; 195 | pulse(myPulseTimes); 196 | 197 | } 198 | 199 | void FancyLED::pulse(void) { 200 | 201 | pulse(0); 202 | 203 | } 204 | 205 | void FancyLED::fusedPulse(long myFuseLength, int myPulseTimes){ 206 | _fuseTimer = myFuseLength + _currentTime; 207 | pulse(myPulseTimes); 208 | } 209 | 210 | int FancyLED::getDutyCycle(void){ 211 | return _dutyCycle; 212 | } 213 | 214 | void FancyLED::setDutyCycle(int newDC) { 215 | _dutyCycle = newDC; 216 | } 217 | 218 | long FancyLED::getFullPeriod(void){ 219 | return _fullPeriod; 220 | } 221 | 222 | void FancyLED::setFullPeriod(long newFP){ 223 | _fullPeriod = newFP; 224 | } 225 | 226 | 227 | 228 | // Private Methods ////////////////////////////////////////////////////////////// 229 | // Functions available to the library only. 230 | 231 | 232 | void FancyLED::updatePin(bool pinValue) { 233 | 234 | if(!_type) { 235 | digitalWrite(_myPin, pinValue); 236 | } else { 237 | _registerValue = *_myRegister; 238 | if (pinValue) { 239 | _registerValue |= (1 << _myBit); 240 | } else { 241 | _registerValue &=~ (1 << _myBit); 242 | } 243 | *_myRegister = _registerValue; 244 | } 245 | 246 | } 247 | -------------------------------------------------------------------------------- /Serial2Net_ESP8266/Serial2Net_ESP8266.ino: -------------------------------------------------------------------------------- 1 | /* 2 | Serial2Net ESP8266 3 | https://github.com/soif/Serial2Net_ESP8266 4 | Copyright 2017 François Déchery 5 | 6 | ** Description ********************************************************** 7 | Briges a Serial Port to/from a (Wifi attached) LAN using a ESP8266 board 8 | 9 | ** Inpired by *********************************************************** 10 | * ESP8266 Ser2net by Daniel Parnell 11 | https://github.com/dparnell/esp8266-ser2net/blob/master/esp8266_ser2net.ino 12 | 13 | * WiFiTelnetToSerial by Hristo Gochkov. 14 | https://github.com/esp8266/Arduino/blob/master/libraries/ESP8266WiFi/examples/WiFiTelnetToSerial/WiFiTelnetToSerial.ino 15 | */ 16 | 17 | // Use your Own Config ######################################################### 18 | #include "config_CUSTOM.h" 19 | //#include "config_315.h" 20 | //#include "config_433.h" 21 | 22 | 23 | // Includes ################################################################### 24 | #include 25 | #include // https://github.com/jej/Arduino-Library-FancyLED 26 | #include // https://github.com/martin-podlubny/arduino-library-syncled 27 | 28 | 29 | // Defines ##################################################################### 30 | #define MAX_SRV_CLIENTS 4 31 | 32 | #define PATTERN_DURATION 180ul 33 | #define PATTERN_PAUSE_COUNT 3 34 | #define PATTERN_ON_COUNT 1 35 | #define PATTERN_OFF_COUNT 1 36 | 37 | #define LED_PLULSE_DURATION 120 38 | #define LED_PLULSE_ON_PERCENT 70 39 | 40 | 41 | // Variables ################################################################### 42 | int last_srv_clients_count=0; 43 | 44 | WiFiServer server(TCP_LISTEN_PORT); 45 | WiFiClient serverClients[MAX_SRV_CLIENTS]; 46 | 47 | FancyLED led_tx = FancyLED(RX_LED, HIGH); 48 | FancyLED led_rx = FancyLED(TX_LED, HIGH); 49 | FancyLED led_wifi = FancyLED(WIFI_LED, HIGH); 50 | SyncLED led_connect(CONNECTION_LED); 51 | 52 | 53 | // ############################################################################# 54 | // Main ######################################################################## 55 | // ############################################################################# 56 | 57 | // ---------------------------------------------------------------------------- 58 | void setup(void){ 59 | 60 | #ifdef USE_WDT 61 | wdt_enable(1000); 62 | #endif 63 | 64 | // Set Leds 65 | led_connect.setRate(PATTERN_DURATION); 66 | led_connect.Off(); 67 | led_rx.setFullPeriod(LED_PLULSE_DURATION); 68 | led_rx.setDutyCycle(LED_PLULSE_ON_PERCENT); 69 | led_tx.setFullPeriod(LED_PLULSE_DURATION); 70 | led_tx.setDutyCycle(LED_PLULSE_ON_PERCENT); 71 | 72 | // Connect to WiFi network 73 | connect_to_wifi(); 74 | 75 | // Start UART 76 | Serial.begin(BAUD_RATE); 77 | 78 | // Start server 79 | server.begin(); 80 | server.setNoDelay(true); 81 | } 82 | 83 | 84 | // ---------------------------------------------------------------------------- 85 | void loop(void){ 86 | led_tx.update(); 87 | led_rx.update(); 88 | led_connect.update(); 89 | //led_wifi.update(); 90 | 91 | #ifdef USE_WDT 92 | wdt_reset(); 93 | #endif 94 | 95 | // Check Wifi connection ----------------- 96 | if(WiFi.status() != WL_CONNECTED) { 97 | // we've lost the connection, so we need to reconnect 98 | for(byte i = 0; i < MAX_SRV_CLIENTS; i++){ 99 | if(serverClients[i]){ 100 | serverClients[i].stop(); 101 | } 102 | } 103 | connect_to_wifi(); 104 | } 105 | 106 | // Check if there are any new clients --------- 107 | uint8_t i; 108 | if (server.hasClient()){ 109 | for(i = 0; i < MAX_SRV_CLIENTS; i++){ 110 | //find free/disconnected spot 111 | if (!serverClients[i] || !serverClients[i].connected()){ 112 | if(serverClients[i]){ 113 | serverClients[i].stop(); 114 | } 115 | serverClients[i] = server.available(); 116 | //Serial1.print("New client: "); Serial1.print(i); 117 | continue; 118 | } 119 | } 120 | // No free/disconnected spot so reject 121 | WiFiClient serverClient = server.available(); 122 | serverClient.stop(); 123 | } 124 | 125 | //blink according to clients connected --------- 126 | int srv_clients_count=0; 127 | for(i = 0; i < MAX_SRV_CLIENTS; i++){ 128 | if (serverClients[i] && serverClients[i].connected()){ 129 | srv_clients_count++; 130 | } 131 | } 132 | 133 | if(srv_clients_count != last_srv_clients_count){ 134 | last_srv_clients_count=srv_clients_count; 135 | UpdateBlinkPattern(srv_clients_count); 136 | } 137 | 138 | // check clients for data ------------------------ 139 | for(i = 0; i < MAX_SRV_CLIENTS; i++){ 140 | if (serverClients[i] && serverClients[i].connected()){ 141 | if(serverClients[i].available()){ 142 | //get data from the telnet client and push it to the UART 143 | while(serverClients[i].available()) { 144 | led_tx.pulse(); 145 | Serial.write(serverClients[i].read()); 146 | led_tx.update(); 147 | } 148 | } 149 | } 150 | } 151 | 152 | // check UART for data -------------------------- 153 | if(Serial.available()){ 154 | size_t len = Serial.available(); 155 | uint8_t sbuf[len]; 156 | Serial.readBytes(sbuf, len); 157 | //push UART data to all connected telnet clients 158 | for(i = 0; i < MAX_SRV_CLIENTS; i++){ 159 | if (serverClients[i] && serverClients[i].connected()){ 160 | led_rx.pulse(); 161 | serverClients[i].write(sbuf, len); 162 | led_tx.update(); 163 | delay(1); 164 | } 165 | } 166 | } 167 | } 168 | 169 | 170 | // Functions ################################################################### 171 | 172 | // ---------------------------------------------------------------------------- 173 | void connect_to_wifi() { 174 | 175 | // is this really needed ? 176 | WiFi.mode(WIFI_STA); 177 | WiFi.disconnect(); 178 | delay(100); 179 | 180 | // connect 181 | WiFi.begin(WIFI_SSID, WIFI_PASSWORD); 182 | 183 | #ifdef STATIC_IP 184 | IPAddress ip_address = parse_ip_address(IP_ADDRESS); 185 | IPAddress gateway_address = parse_ip_address(GATEWAY_ADDRESS); 186 | IPAddress netmask = parse_ip_address(NET_MASK); 187 | WiFi.config(ip_address, gateway_address, netmask); 188 | #endif 189 | 190 | led_connect.Off(); 191 | led_wifi.turnOff(); 192 | led_tx.turnOff(); 193 | led_rx.turnOff(); 194 | 195 | // Wait for WIFI connection 196 | while (WiFi.status() != WL_CONNECTED) { 197 | #ifdef USE_WDT 198 | wdt_reset(); 199 | #endif 200 | led_wifi.toggle(); 201 | delay(100); 202 | } 203 | led_wifi.turnOn(); 204 | } 205 | 206 | 207 | // ---------------------------------------------------------------------------- 208 | void UpdateBlinkPattern(int srv_count){ 209 | if(srv_count > 0){ 210 | unsigned long pattern=0; 211 | int len= ( (PATTERN_ON_COUNT + PATTERN_OFF_COUNT) * srv_count ) + PATTERN_PAUSE_COUNT; 212 | 213 | if(len > 32){ 214 | pattern=0B1101101010; 215 | len=10; 216 | } 217 | else if(srv_count==1){ 218 | pattern=0B1111; 219 | len=4; 220 | } 221 | else{ 222 | //build pattern (from right to left) 223 | int b=0; 224 | for(int i=0; i < PATTERN_PAUSE_COUNT; i++){ 225 | bitWrite(pattern,b,0); 226 | b++; 227 | } 228 | for (int i=0 ; i < srv_count; i++){ 229 | for(int j=0; j < PATTERN_OFF_COUNT; j++){ 230 | bitWrite(pattern,b, 0); 231 | b++; 232 | } 233 | for(int k=0; k < PATTERN_ON_COUNT; k++){ 234 | bitWrite(pattern,b, 1); 235 | b++; 236 | } 237 | } 238 | } 239 | //Serial.print(pattern,BIN); 240 | led_connect.setPattern(pattern, len); 241 | } 242 | else{ 243 | led_connect.Off(); 244 | } 245 | } 246 | 247 | 248 | // ---------------------------------------------------------------------------- 249 | IPAddress parse_ip_address(const char *str) { 250 | IPAddress result; 251 | int index = 0; 252 | result[0] = 0; 253 | while (*str) { 254 | if (isdigit((unsigned char)*str)) { 255 | result[index] *= 10; 256 | result[index] += *str - '0'; 257 | } 258 | else { 259 | index++; 260 | if(index<4) { 261 | result[index] = 0; 262 | } 263 | } 264 | str++; 265 | } 266 | return result; 267 | } 268 | -------------------------------------------------------------------------------- /COPYING: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 2, June 1991 3 | 4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc., 5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 6 | Everyone is permitted to copy and distribute verbatim copies 7 | of this license document, but changing it is not allowed. 8 | 9 | Preamble 10 | 11 | The licenses for most software are designed to take away your 12 | freedom to share and change it. By contrast, the GNU General Public 13 | License is intended to guarantee your freedom to share and change free 14 | software--to make sure the software is free for all its users. This 15 | General Public License applies to most of the Free Software 16 | Foundation's software and to any other program whose authors commit to 17 | using it. (Some other Free Software Foundation software is covered by 18 | the GNU Lesser General Public License instead.) You can apply it to 19 | your programs, too. 20 | 21 | When we speak of free software, we are referring to freedom, not 22 | price. Our General Public Licenses are designed to make sure that you 23 | have the freedom to distribute copies of free software (and charge for 24 | this service if you wish), that you receive source code or can get it 25 | if you want it, that you can change the software or use pieces of it 26 | in new free programs; and that you know you can do these things. 27 | 28 | To protect your rights, we need to make restrictions that forbid 29 | anyone to deny you these rights or to ask you to surrender the rights. 30 | These restrictions translate to certain responsibilities for you if you 31 | distribute copies of the software, or if you modify it. 32 | 33 | For example, if you distribute copies of such a program, whether 34 | gratis or for a fee, you must give the recipients all the rights that 35 | you have. You must make sure that they, too, receive or can get the 36 | source code. And you must show them these terms so they know their 37 | rights. 38 | 39 | We protect your rights with two steps: (1) copyright the software, and 40 | (2) offer you this license which gives you legal permission to copy, 41 | distribute and/or modify the software. 42 | 43 | Also, for each author's protection and ours, we want to make certain 44 | that everyone understands that there is no warranty for this free 45 | software. If the software is modified by someone else and passed on, we 46 | want its recipients to know that what they have is not the original, so 47 | that any problems introduced by others will not reflect on the original 48 | authors' reputations. 49 | 50 | Finally, any free program is threatened constantly by software 51 | patents. We wish to avoid the danger that redistributors of a free 52 | program will individually obtain patent licenses, in effect making the 53 | program proprietary. To prevent this, we have made it clear that any 54 | patent must be licensed for everyone's free use or not licensed at all. 55 | 56 | The precise terms and conditions for copying, distribution and 57 | modification follow. 58 | 59 | GNU GENERAL PUBLIC LICENSE 60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 61 | 62 | 0. This License applies to any program or other work which contains 63 | a notice placed by the copyright holder saying it may be distributed 64 | under the terms of this General Public License. The "Program", below, 65 | refers to any such program or work, and a "work based on the Program" 66 | means either the Program or any derivative work under copyright law: 67 | that is to say, a work containing the Program or a portion of it, 68 | either verbatim or with modifications and/or translated into another 69 | language. (Hereinafter, translation is included without limitation in 70 | the term "modification".) Each licensee is addressed as "you". 71 | 72 | Activities other than copying, distribution and modification are not 73 | covered by this License; they are outside its scope. The act of 74 | running the Program is not restricted, and the output from the Program 75 | is covered only if its contents constitute a work based on the 76 | Program (independent of having been made by running the Program). 77 | Whether that is true depends on what the Program does. 78 | 79 | 1. You may copy and distribute verbatim copies of the Program's 80 | source code as you receive it, in any medium, provided that you 81 | conspicuously and appropriately publish on each copy an appropriate 82 | copyright notice and disclaimer of warranty; keep intact all the 83 | notices that refer to this License and to the absence of any warranty; 84 | and give any other recipients of the Program a copy of this License 85 | along with the Program. 86 | 87 | You may charge a fee for the physical act of transferring a copy, and 88 | you may at your option offer warranty protection in exchange for a fee. 89 | 90 | 2. You may modify your copy or copies of the Program or any portion 91 | of it, thus forming a work based on the Program, and copy and 92 | distribute such modifications or work under the terms of Section 1 93 | above, provided that you also meet all of these conditions: 94 | 95 | a) You must cause the modified files to carry prominent notices 96 | stating that you changed the files and the date of any change. 97 | 98 | b) You must cause any work that you distribute or publish, that in 99 | whole or in part contains or is derived from the Program or any 100 | part thereof, to be licensed as a whole at no charge to all third 101 | parties under the terms of this License. 102 | 103 | c) If the modified program normally reads commands interactively 104 | when run, you must cause it, when started running for such 105 | interactive use in the most ordinary way, to print or display an 106 | announcement including an appropriate copyright notice and a 107 | notice that there is no warranty (or else, saying that you provide 108 | a warranty) and that users may redistribute the program under 109 | these conditions, and telling the user how to view a copy of this 110 | License. (Exception: if the Program itself is interactive but 111 | does not normally print such an announcement, your work based on 112 | the Program is not required to print an announcement.) 113 | 114 | These requirements apply to the modified work as a whole. If 115 | identifiable sections of that work are not derived from the Program, 116 | and can be reasonably considered independent and separate works in 117 | themselves, then this License, and its terms, do not apply to those 118 | sections when you distribute them as separate works. But when you 119 | distribute the same sections as part of a whole which is a work based 120 | on the Program, the distribution of the whole must be on the terms of 121 | this License, whose permissions for other licensees extend to the 122 | entire whole, and thus to each and every part regardless of who wrote it. 123 | 124 | Thus, it is not the intent of this section to claim rights or contest 125 | your rights to work written entirely by you; rather, the intent is to 126 | exercise the right to control the distribution of derivative or 127 | collective works based on the Program. 128 | 129 | In addition, mere aggregation of another work not based on the Program 130 | with the Program (or with a work based on the Program) on a volume of 131 | a storage or distribution medium does not bring the other work under 132 | the scope of this License. 133 | 134 | 3. You may copy and distribute the Program (or a work based on it, 135 | under Section 2) in object code or executable form under the terms of 136 | Sections 1 and 2 above provided that you also do one of the following: 137 | 138 | a) Accompany it with the complete corresponding machine-readable 139 | source code, which must be distributed under the terms of Sections 140 | 1 and 2 above on a medium customarily used for software interchange; or, 141 | 142 | b) Accompany it with a written offer, valid for at least three 143 | years, to give any third party, for a charge no more than your 144 | cost of physically performing source distribution, a complete 145 | machine-readable copy of the corresponding source code, to be 146 | distributed under the terms of Sections 1 and 2 above on a medium 147 | customarily used for software interchange; or, 148 | 149 | c) Accompany it with the information you received as to the offer 150 | to distribute corresponding source code. (This alternative is 151 | allowed only for noncommercial distribution and only if you 152 | received the program in object code or executable form with such 153 | an offer, in accord with Subsection b above.) 154 | 155 | The source code for a work means the preferred form of the work for 156 | making modifications to it. For an executable work, complete source 157 | code means all the source code for all modules it contains, plus any 158 | associated interface definition files, plus the scripts used to 159 | control compilation and installation of the executable. However, as a 160 | special exception, the source code distributed need not include 161 | anything that is normally distributed (in either source or binary 162 | form) with the major components (compiler, kernel, and so on) of the 163 | operating system on which the executable runs, unless that component 164 | itself accompanies the executable. 165 | 166 | If distribution of executable or object code is made by offering 167 | access to copy from a designated place, then offering equivalent 168 | access to copy the source code from the same place counts as 169 | distribution of the source code, even though third parties are not 170 | compelled to copy the source along with the object code. 171 | 172 | 4. You may not copy, modify, sublicense, or distribute the Program 173 | except as expressly provided under this License. Any attempt 174 | otherwise to copy, modify, sublicense or distribute the Program is 175 | void, and will automatically terminate your rights under this License. 176 | However, parties who have received copies, or rights, from you under 177 | this License will not have their licenses terminated so long as such 178 | parties remain in full compliance. 179 | 180 | 5. You are not required to accept this License, since you have not 181 | signed it. However, nothing else grants you permission to modify or 182 | distribute the Program or its derivative works. These actions are 183 | prohibited by law if you do not accept this License. Therefore, by 184 | modifying or distributing the Program (or any work based on the 185 | Program), you indicate your acceptance of this License to do so, and 186 | all its terms and conditions for copying, distributing or modifying 187 | the Program or works based on it. 188 | 189 | 6. Each time you redistribute the Program (or any work based on the 190 | Program), the recipient automatically receives a license from the 191 | original licensor to copy, distribute or modify the Program subject to 192 | these terms and conditions. You may not impose any further 193 | restrictions on the recipients' exercise of the rights granted herein. 194 | You are not responsible for enforcing compliance by third parties to 195 | this License. 196 | 197 | 7. If, as a consequence of a court judgment or allegation of patent 198 | infringement or for any other reason (not limited to patent issues), 199 | conditions are imposed on you (whether by court order, agreement or 200 | otherwise) that contradict the conditions of this License, they do not 201 | excuse you from the conditions of this License. If you cannot 202 | distribute so as to satisfy simultaneously your obligations under this 203 | License and any other pertinent obligations, then as a consequence you 204 | may not distribute the Program at all. For example, if a patent 205 | license would not permit royalty-free redistribution of the Program by 206 | all those who receive copies directly or indirectly through you, then 207 | the only way you could satisfy both it and this License would be to 208 | refrain entirely from distribution of the Program. 209 | 210 | If any portion of this section is held invalid or unenforceable under 211 | any particular circumstance, the balance of the section is intended to 212 | apply and the section as a whole is intended to apply in other 213 | circumstances. 214 | 215 | It is not the purpose of this section to induce you to infringe any 216 | patents or other property right claims or to contest validity of any 217 | such claims; this section has the sole purpose of protecting the 218 | integrity of the free software distribution system, which is 219 | implemented by public license practices. Many people have made 220 | generous contributions to the wide range of software distributed 221 | through that system in reliance on consistent application of that 222 | system; it is up to the author/donor to decide if he or she is willing 223 | to distribute software through any other system and a licensee cannot 224 | impose that choice. 225 | 226 | This section is intended to make thoroughly clear what is believed to 227 | be a consequence of the rest of this License. 228 | 229 | 8. If the distribution and/or use of the Program is restricted in 230 | certain countries either by patents or by copyrighted interfaces, the 231 | original copyright holder who places the Program under this License 232 | may add an explicit geographical distribution limitation excluding 233 | those countries, so that distribution is permitted only in or among 234 | countries not thus excluded. In such case, this License incorporates 235 | the limitation as if written in the body of this License. 236 | 237 | 9. The Free Software Foundation may publish revised and/or new versions 238 | of the General Public License from time to time. Such new versions will 239 | be similar in spirit to the present version, but may differ in detail to 240 | address new problems or concerns. 241 | 242 | Each version is given a distinguishing version number. If the Program 243 | specifies a version number of this License which applies to it and "any 244 | later version", you have the option of following the terms and conditions 245 | either of that version or of any later version published by the Free 246 | Software Foundation. If the Program does not specify a version number of 247 | this License, you may choose any version ever published by the Free Software 248 | Foundation. 249 | 250 | 10. If you wish to incorporate parts of the Program into other free 251 | programs whose distribution conditions are different, write to the author 252 | to ask for permission. For software which is copyrighted by the Free 253 | Software Foundation, write to the Free Software Foundation; we sometimes 254 | make exceptions for this. Our decision will be guided by the two goals 255 | of preserving the free status of all derivatives of our free software and 256 | of promoting the sharing and reuse of software generally. 257 | 258 | NO WARRANTY 259 | 260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 268 | REPAIR OR CORRECTION. 269 | 270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 278 | POSSIBILITY OF SUCH DAMAGES. 279 | 280 | END OF TERMS AND CONDITIONS 281 | 282 | How to Apply These Terms to Your New Programs 283 | 284 | If you develop a new program, and you want it to be of the greatest 285 | possible use to the public, the best way to achieve this is to make it 286 | free software which everyone can redistribute and change under these terms. 287 | 288 | To do so, attach the following notices to the program. It is safest 289 | to attach them to the start of each source file to most effectively 290 | convey the exclusion of warranty; and each file should have at least 291 | the "copyright" line and a pointer to where the full notice is found. 292 | 293 | 294 | Copyright (C) 295 | 296 | This program is free software; you can redistribute it and/or modify 297 | it under the terms of the GNU General Public License as published by 298 | the Free Software Foundation; either version 2 of the License, or 299 | (at your option) any later version. 300 | 301 | This program is distributed in the hope that it will be useful, 302 | but WITHOUT ANY WARRANTY; without even the implied warranty of 303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 304 | GNU General Public License for more details. 305 | 306 | You should have received a copy of the GNU General Public License along 307 | with this program; if not, write to the Free Software Foundation, Inc., 308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. 309 | 310 | Also add information on how to contact you by electronic and paper mail. 311 | 312 | If the program is interactive, make it output a short notice like this 313 | when it starts in an interactive mode: 314 | 315 | Gnomovision version 69, Copyright (C) year name of author 316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 317 | This is free software, and you are welcome to redistribute it 318 | under certain conditions; type `show c' for details. 319 | 320 | The hypothetical commands `show w' and `show c' should show the appropriate 321 | parts of the General Public License. Of course, the commands you use may 322 | be called something other than `show w' and `show c'; they could even be 323 | mouse-clicks or menu items--whatever suits your program. 324 | 325 | You should also get your employer (if you work as a programmer) or your 326 | school, if any, to sign a "copyright disclaimer" for the program, if 327 | necessary. Here is a sample; alter the names: 328 | 329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program 330 | `Gnomovision' (which makes passes at compilers) written by James Hacker. 331 | 332 | , 1 April 1989 333 | Ty Coon, President of Vice 334 | 335 | This General Public License does not permit incorporating your program into 336 | proprietary programs. If your program is a subroutine library, you may 337 | consider it more useful to permit linking proprietary applications with the 338 | library. If this is what you want to do, use the GNU Lesser General 339 | Public License instead of this License. --------------------------------------------------------------------------------