diff --git a/.travis.yml b/.travis.yml index 5f5defe..66a5b06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,20 +1,18 @@ language: c -sudo: false +sudo: true cache: - directories: - - ~/arduino_ide - - ~/.arduino15/packages/ + directories: + - ~/arduino_ide + - ~/.arduino15/packages/ git: - depth: false - quiet: true + depth: false + quiet: true env: - global: - - PRETTYNAME="NeoPatterns Arduino Library" + global: + - PRETTYNAME="NeoPatterns Arduino Library" + - INSTALL_PLATFORMS="avr,esp8266,esp32,stm32" before_install: -# Workaround for avoiding "fork/exec /bin/xtensa-lx106-elf-g++: no such file or directory" -- echo "Removing ESP8266 cache" -- rm -rf ~/.arduino15/packages/esp8266 -- source <(curl -SLs https://raw.githubusercontent.com/adafruit/travis-ci-arduino/master/install.sh) +- source <(curl -SLs https://raw.githubusercontent.com/ArminJo/travis-ci-arduino/master/install.sh) install: - arduino --install-library "Adafruit NeoPixel" script: @@ -25,8 +23,8 @@ script: - build_platform esp8266 - build_platform esp32 notifications: - email: - recipients: + email: + recipients: - armin.arduino@gmail.com - on_success: always - on_failure: always \ No newline at end of file + on_success: always + on_failure: always \ No newline at end of file diff --git a/README.md b/README.md index d3d599f..2adcd86 100644 --- a/README.md +++ b/README.md @@ -75,11 +75,14 @@ NeoPatterns on breadboard ![NeoPatterns on breadboard](https://github.com/ArminJo/NeoPatterns/blob/master/extras/Breadboard_complete.jpg) # Revision History +### Version 2.2.0 +- Added OpenLedRace example. + ### Version 2.1.0 - Ported to ESP8266 and ESP32. - Changed signature of NeoPatterns(NeoPixel * aUnderlyingNeoPixelObject). Swapped 4. and 5. parameter to make it consistent to the NeoPixel signature. -- Added OpenLedRace example. - Function `setPixelOffsetForPartialNeoPixel()` in NeoPixel.cpp added. + ### Version 2.0.0 - Rewrite of most patterns control logic. - Function `drawBar()` in NeoPixel.cpp added. @@ -109,6 +112,8 @@ The NeoPatterns library examples are built on Travis CI for the following boards - Arduino Uno - Arduino Leonardo - Arduino Mega 2560 +- ESP8266 boards (tested with LOLIN D1 R2 board) +- ESP32 boards (tested with ESP32 DEVKITV1 board) ## Requests for modifications / extensions Please write me a PM including your motivation/problem if you need a modification or an extension. diff --git a/examples/AllPatternOnOneStrip/AllPatternOnOneStrip.ino b/examples/AllPatternOnOneStrip/AllPatternOnOneStrip.ino index 174f7a1..39d0146 100644 --- a/examples/AllPatternOnOneStrip/AllPatternOnOneStrip.ino +++ b/examples/AllPatternOnOneStrip/AllPatternOnOneStrip.ino @@ -55,10 +55,16 @@ NeoPatterns bar16 = NeoPatterns(16, PIN_NEOPIXEL_BAR_16, NEO_GRB + NEO_KHZ800, & #endif void setup() { + pinMode(LED_BUILTIN, OUTPUT); + #ifdef INFO Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); #endif diff --git a/examples/AllPatternsOnMultiDevices/AllPatternsOnMultiDevices.ino b/examples/AllPatternsOnMultiDevices/AllPatternsOnMultiDevices.ino index 944a94a..e79de31 100644 --- a/examples/AllPatternsOnMultiDevices/AllPatternsOnMultiDevices.ino +++ b/examples/AllPatternsOnMultiDevices/AllPatternsOnMultiDevices.ino @@ -87,8 +87,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/MatrixDemo/MatrixDemo.ino b/examples/MatrixDemo/MatrixDemo.ino index 5a90f16..6cc4b37 100644 --- a/examples/MatrixDemo/MatrixDemo.ino +++ b/examples/MatrixDemo/MatrixDemo.ino @@ -48,8 +48,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/MatrixShowAllColors/MatrixShowAllColors.ino b/examples/MatrixShowAllColors/MatrixShowAllColors.ino index e2dbbb5..bf135cb 100644 --- a/examples/MatrixShowAllColors/MatrixShowAllColors.ino +++ b/examples/MatrixShowAllColors/MatrixShowAllColors.ino @@ -48,8 +48,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/MultiplePatternsOnOneBar/MultiplePatternsOnOneBar.ino b/examples/MultiplePatternsOnOneBar/MultiplePatternsOnOneBar.ino index 4fb3f62..fa4998d 100644 --- a/examples/MultiplePatternsOnOneBar/MultiplePatternsOnOneBar.ino +++ b/examples/MultiplePatternsOnOneBar/MultiplePatternsOnOneBar.ino @@ -48,8 +48,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/NeoPatternsSimpleDemo/NeoPatternsSimpleDemo.ino b/examples/NeoPatternsSimpleDemo/NeoPatternsSimpleDemo.ino index a1d162f..895c3ed 100644 --- a/examples/NeoPatternsSimpleDemo/NeoPatternsSimpleDemo.ino +++ b/examples/NeoPatternsSimpleDemo/NeoPatternsSimpleDemo.ino @@ -40,8 +40,12 @@ NeoPatterns bar16 = NeoPatterns(16, PIN_NEOPIXEL_BAR_16, NEO_GRB + NEO_KHZ800, & void setup() { Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/SnakeAutorun/SnakeAutorun.ino b/examples/SnakeAutorun/SnakeAutorun.ino index 54b1009..fa017f8 100644 --- a/examples/SnakeAutorun/SnakeAutorun.ino +++ b/examples/SnakeAutorun/SnakeAutorun.ino @@ -141,8 +141,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/SnakeGame/SnakeGame.ino b/examples/SnakeGame/SnakeGame.ino index f0a5bc7..e989cf0 100644 --- a/examples/SnakeGame/SnakeGame.ino +++ b/examples/SnakeGame/SnakeGame.ino @@ -61,8 +61,12 @@ void setup() { pinMode(TWO_BUTTON_MODE_SELECT_PIN, INPUT_PULLUP); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/SnowFlakes/SnowFlakes.ino b/examples/SnowFlakes/SnowFlakes.ino index b45c903..b4dba0e 100644 --- a/examples/SnowFlakes/SnowFlakes.ino +++ b/examples/SnowFlakes/SnowFlakes.ino @@ -50,8 +50,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/examples/TwoPatternsOnOneStrip/EasyButtonAtInt01.h b/examples/TwoPatternsOnOneStrip/EasyButtonAtInt01.h index ccad002..6e30379 100644 --- a/examples/TwoPatternsOnOneStrip/EasyButtonAtInt01.h +++ b/examples/TwoPatternsOnOneStrip/EasyButtonAtInt01.h @@ -76,9 +76,13 @@ */ //#define LED_FEEDBACK_FOR_DEBOUNCE_TEST #if defined (LED_FEEDBACK_FOR_DEBOUNCE_TEST) -#ifndef BUTTON_TEST_FEEDBACK_LED_PIN -#define BUTTON_TEST_FEEDBACK_LED_PIN LED_BUILTIN // if not specified, use built in led - pin 13 on Uno board -#endif +# if ! defined(BUTTON_TEST_FEEDBACK_LED_PIN) +# if defined (LED_BUILTIN) +# define BUTTON_TEST_FEEDBACK_LED_PIN LED_BUILTIN // if not specified, use built in led - pin 13 on Uno board +# else +# error "LED_FEEDBACK_FOR_DEBOUNCE_TEST defined but no BUTTON_TEST_FEEDBACK_LED_PIN or LED_BUILTIN defined" +# endif +# endif #endif // diff --git a/examples/TwoPatternsOnOneStrip/TwoPatternsOnOneStrip.ino b/examples/TwoPatternsOnOneStrip/TwoPatternsOnOneStrip.ino index 8c8785c..272db00 100644 --- a/examples/TwoPatternsOnOneStrip/TwoPatternsOnOneStrip.ino +++ b/examples/TwoPatternsOnOneStrip/TwoPatternsOnOneStrip.ino @@ -83,8 +83,12 @@ void setup() { pinMode(LED_BUILTIN, OUTPUT); Serial.begin(115200); - while (!Serial) - ; //delay for Leonardo +#if defined(__AVR_ATmega32U4__) + while (!Serial); //delay for Leonardo, but this loops forever for Maple Serial +#endif +#if defined(SERIAL_USB) + delay(2000); // To be able to connect Serial monitor after reset and before first printout +#endif // Just to know which program is running on my Arduino Serial.println(F("START " __FILE__ "\r\nVersion " VERSION_EXAMPLE " from " __DATE__)); diff --git a/src/NeoPatterns.cpp b/src/NeoPatterns.cpp index f0366fe..dca9001 100644 --- a/src/NeoPatterns.cpp +++ b/src/NeoPatterns.cpp @@ -108,7 +108,7 @@ NeoPatterns::NeoPatterns(uint16_t aNumberOfPixels, uint8_t aPin, uint8_t aTypeOf * } */ NeoPatterns::NeoPatterns(NeoPixel * aUnderlyingNeoPixelObject, uint16_t aPixelOffset, uint16_t aNumberOfPixels, // @suppress("Class members should be properly initialized") - bool aEnableShowOfUnderlyingPixel,void (*aPatternCompletionCallback)(NeoPatterns*), bool aShowOnlyAtUpdate) : + bool aEnableShowOfUnderlyingPixel, void (*aPatternCompletionCallback)(NeoPatterns*), bool aShowOnlyAtUpdate) : NeoPixel(aUnderlyingNeoPixelObject, aPixelOffset, aNumberOfPixels, aEnableShowOfUnderlyingPixel) { OnPatternComplete = aPatternCompletionCallback;