text:
SD card breakout sometimes does not initialise (SPI connection - Teensy 3.2)
I have connected this Adafruit SD Breakout to a Teensy 3.2 over SPI. Because Teensy 3.2 is 3.3 V, I've connected the 3.3 V pin of the Teensy to the 3V pin of the SD breakout.
See sketch below. I'm using Arduino IDE 2.0.4. The SD card is a micro SD HC 32 GB, see photos. FAT32.
The SD setup usually goes fine, but every now and then it fails. Whenever the setup goes fine, writing data to the SD card thereafter also goes fine. Does anyone know what this failing could be caused by? Perhaps the SD card is a bit flaky? Or something in software (library)?
My initial guess would be with the wiring, but I've seen similar problems on a PCB with a SD module on it. Hence I think there's more at play than just wiring.
N.B. on the photo you can see there is also an ADXL breakout board connected. However that is over I2C and does not participate in this setup. I've left it in there because I don't want to have to take it out and reconnect it later.
/*
  SD card datalogger

  This example shows how to log data from three analog sensors
  to an SD card using the SD library. Pin numbers reflect the default
  SPI pins for Uno and Nano models

  The circuit:
   analog sensors on analog pins 0, 1, and 2
   SD card attached to SPI bus as follows:
 ** SDO - pin 11
 ** SDI - pin 12
 ** CLK - pin 13
 ** CS - depends on your SD card shield or module.
        Pin 10 used here for consistency with other Arduino examples
    (for MKR Zero SD: SDCARD_SS_PIN)

  created  24 Nov 2010
  modified  24 July 2020
  by Tom Igoe

  This example code is in the public domain.

*/

#include <SPI.h>
#include <SD.h>

const int chipSelect = 10;
#define LED_PIN 7

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  // wait for Serial Monitor to connect. Needed for native USB port boards only:

  pinMode(LED_PIN, OUTPUT);
  Serial.print("Initializing SD card...");

  while(!SD.begin(chipSelect)) {
    Serial.println("SD initialization failed.");
    delay(100);
    digitalWrite(LED_PIN, HIGH);
    delay(50);
    digitalWrite(LED_PIN, LOW);
    delay(50);
    digitalWrite(LED_PIN, HIGH);
  }

  Serial.println("initialization done.");
  digitalWrite(LED_PIN, HIGH);
}

void loop() {
  // make a string for assembling the data to log:
  String dataString = "";

  // read three sensors and append to the string:
  for (int analogPin = 0; analogPin < 3; analogPin++) {
    int sensor = analogRead(analogPin);
    dataString += String(sensor);
    if (analogPin < 2) {
      dataString += ",";
    }
  }

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  File dataFile = SD.open("datalog.txt", FILE_WRITE);

  // if the file is available, write to it:
  if (dataFile) {
    dataFile.println(dataString);
    dataFile.close();
    // print to the serial port too:
    // Serial.println(dataString);
  }
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");
  }
}

Output:
09:09:03.970 -> Initializing SD card...initialization done.
09:09:19.976 -> Initializing SD card...initialization done.
09:09:28.293 -> Initializing SD card...initialization done.
09:09:38.538 -> Initializing SD card...SD initialization failed.
09:09:42.748 -> SD initialization failed.
09:09:44.924 -> SD initialization failed.
09:09:47.140 -> SD initialization failed.
09:09:49.346 -> SD initialization failed.
09:09:51.556 -> SD initialization failed.
09:09:53.770 -> SD initialization failed.
09:09:55.939 -> SD initialization failed.
09:09:58.147 -> SD initialization failed.
09:10:00.352 -> SD initialization failed.
09:10:02.518 -> SD initialization failed.
09:10:04.725 -> SD initialization failed.
09:10:06.965 -> SD initialization failed.
09:10:09.160 -> SD initialization failed.
09:10:11.353 -> SD initialization failed.
09:10:13.566 -> SD initialization failed.
09:10:15.775 -> SD initialization failed.
09:10:17.954 -> SD initialization failed.
09:10:20.169 -> SD initialization failed.
09:10:22.368 -> SD initialization failed.
09:10:24.574 -> SD initialization failed.
09:10:26.777 -> SD initialization failed.
09:10:28.979 -> SD initialization failed.
09:10:31.159 -> SD initialization failed.
09:10:33.376 -> SD initialization failed.
09:10:35.565 -> SD initialization failed.
09:10:37.783 -> SD initialization failed.
09:10:39.978 -> SD initialization failed.
09:10:42.166 -> SD initialization failed.
09:10:44.384 -> SD initialization failed.
09:10:46.573 -> SD initialization failed.
09:10:48.793 -> SD initialization failed.
09:10:50.974 -> SD initialization failed.
09:11:51.284 -> Initializing SD card...initialization done.
09:12:18.656 -> Initializing SD card...initialization done.
09:12:28.948 -> Initializing SD card...initialization done.
09:12:32.867 -> Initializing SD card...initialization done.
09:12:38.416 -> Initializing SD card...initialization done.
09:12:44.657 -> Initializing SD card...initialization done.
09:12:52.141 -> Initializing SD card...initialization done.
09:13:08.003 -> Initializing SD card...initialization done.
09:13:10.421 -> Initializing SD card...initialization done.
09:13:12.893 -> Initializing SD card...initialization done.
09:13:15.070 -> Initializing SD card...initialization done.
09:13:17.771 -> Initializing SD card...initialization done.
09:13:19.922 -> Initializing SD card...initialization done.
09:13:25.418 -> Initializing SD card...initialization done.
09:13:28.104 -> Initializing SD card...initialization done.
09:13:30.835 -> Initializing SD card...initialization done.
09:13:33.217 -> Initializing SD card...initialization done.
09:13:36.146 -> Initializing SD card...initialization done.
09:13:40.727 -> Initializing SD card...initialization done.
09:13:44.985 -> Initializing SD card...initialization done.
09:13:49.089 -> Initializing SD card...initialization done.
09:13:51.687 -> Initializing SD card...initialization done.
09:13:55.698 -> Initializing SD card...initialization done.
09:14:00.868 -> Initializing SD card...initialization done.
09:14:03.965 -> Initializing SD card...initialization done.
09:14:06.697 -> Initializing SD card...initialization done.
09:14:10.518 -> Initializing SD card...initialization done.
09:14:13.549 -> Initializing SD card...initialization done.
09:14:18.414 -> Initializing SD card...initialization done.
09:14:22.145 -> Initializing SD card...Initializing SD card...initialization done.
09:14:31.614 -> Initializing SD card...initialization done.
09:14:34.230 -> Initializing SD card...initialization done.
09:14:37.077 -> Initializing SD card...SD initialization failed.
09:14:41.273 -> SD initialization failed.
09:14:43.482 -> SD initialization failed.
09:14:45.675 -> SD initialization failed.
09:14:47.858 -> SD initialization failed.
09:14:50.080 -> SD initialization failed.
09:14:52.286 -> SD initialization failed.
09:14:54.464 -> SD initialization failed.
09:14:56.665 -> SD initialization failed.
09:14:58.931 -> SD initialization failed.
09:15:01.088 -> SD initialization failed.
09:15:03.253 -> SD initialization failed.
09:15:05.482 -> SD initialization failed.
09:15:07.696 -> SD initialization failed.
09:15:09.902 -> SD initialization failed.
09:15:12.096 -> SD initialization failed.
09:15:20.904 -> SD initialization failed.
09:15:23.112 -> SD initialization failed.
09:15:25.287 -> SD initialization failed.
09:15:27.494 -> SD initialization failed.
09:15:29.720 -> SD initialization failed.
09:15:30.936 -> Initializing SD card...SD initialization failed.
09:15:35.095 -> SD initialization failed.
09:15:37.304 -> SD initialization failed.
09:15:39.515 -> SD initialization failed.
09:15:41.713 -> SD initialization failed.
09:15:43.899 -> SD initialization failed.
09:15:46.108 -> SD initialization failed.
09:15:48.320 -> SD initialization failed.
09:15:50.502 -> SD initialization failed.
09:15:52.685 -> SD initialization failed.
09:15:54.920 -> SD initialization failed.
09:15:57.887 -> Initializing SD card...SD initialization failed.
09:16:01.902 -> SD initialization failed.
09:16:04.097 -> SD initialization failed.
09:16:06.312 -> SD initialization failed.
09:16:08.518 -> SD initialization failed.
09:16:10.720 -> SD initialization failed.
09:16:12.901 -> SD initialization failed.
09:16:15.125 -> SD initialization failed.
09:16:17.328 -> SD initialization failed.
09:16:19.521 -> SD initialization failed.
09:16:21.734 -> SD initialization failed.
09:16:23.925 -> SD initialization failed.
09:16:26.097 -> SD initialization failed.
09:16:28.332 -> SD initialization failed.
09:16:30.533 -> SD initialization failed.
09:16:32.732 -> SD initialization failed.
09:16:34.917 -> SD initialization failed.

EDIT: Now I've also added logic analyser output of failed SD setup.
EDIT 2:  The Teensy SD library is used:
Multiple libraries were found for "SD.h"
  Used: C:\Users\xxxxx\AppData\Local\Arduino15\packages\teensy\hardware\avr\1.57.2\libraries\SD
  Not used: C:\Users\xxxx\AppData\Local\Arduino15\libraries\SD

What happens if you eject, then re-insert the SD card while it is stuck in the "SD initialization failed." while loop?

It depends. Once when I did it, the setup completed fine and the SD card was functional after that. Another time it just continued in the "SD initialization failed" loop. And then another time still, the setup completed fine but then the error popped up "error opening datalog.txt".
I have been noticing a pattern where whenever I get the "error opening datalog.txt" error, on subsequent resets the "SD initialization failed" error is more prevalent.

Try ejecting the SD card, then re-inserting it, then reboot the Arduino. Let me know what happens when you do those 3 steps in that order.

Then it immediately goes back into the "SD initialization failed" loop :L


text:
Arduino Due: JTAG and SWD do not work after pressing erase button
I have an Arduino Due board. I can successfully upload code to it using Arduino upload via USB.
However I am also exploring another approach, which is to upload code via Atmel studio using an Atmel ICE and JTAG connection. Usually this works fine (the code uploads, and a simple "blink" sketch makes the onboard LED flash).
However when I press the erase button, and then try to upload the same sketch via Atmel Studio and JTAG, something strange happens. The code uploads fine:
Erasing device... OK
Programming Flash...OK
Verifying Flash...OK

But then the program on the Due does not actually execute. The LED does not start to 'blink'. If I then again upload via USB (programming port) and the Arduino IDE, the blink program does work. And when I then upload via Atmel Studio and JTAG again without pressing the erase button, everything happens as expected too (LED blinks etc).
Does anyone have any idea what might be going on? The reason I ask is because I would like to design a board using only a JTAG connection. Do you think the above problem could cause issues when using a 'blank' factory SAM MCU as well?
EDIT: the same problem applies to SWD.
Blink sketch that i am uploading:
#define led LED_BUILTIN

// the setup routine runs once when you press reset:
void setup() {
  // initialize the digital pin as an output.
  pinMode(led, OUTPUT);
}

// the loop routine runs over and over again forever:
void loop() {
  digitalWrite(led, HIGH);   // turn the LED on (HIGH is the voltage level)
  delay(600);               // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(600);               // wait for a second
}

After uploading via Microchip Studio, go to the GPNVM bits section of "device programming" window. Make sure boot mode is set to "boot from flash". Also check that GPNVMBITS register is set to 0x00000002. Then press "program". The sketch you uploaded to the MCU should now work.
So it seems what happens is that pressing the erase button resets the GPNVM bits so that the MCU boots from ROM, but then Atmel ICE + JTAG/SWD does not set the boot mode back to flash after (succesfully) programming the MCU.

source: Stack Exchange

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/

sort: votes


text:
Bootloader onto an ATmega328p (3.3V/8MHz), the dude won't finish his business
Hi and thank you reading my question !
I need for my projects to design as small as i can. Both the skills, and the hardware counts. So i can't use a DIP package for them, and i have gone for a TQFP package. The point is to programm a TQFP ATmega328P using an external board without soldering it, which plugs into a Arduino UNO. Like that no need to constantly check the connection and everything. The shield is a basically a fat Arduino Pro Mini, with all the options available (3.3V/5V, 8MHz/16MHz, Sparkfun FTDI can be connected, ...) as shown below :

As you can see I am the enginneer of Gymetrics, but not an electronic enginner nor a programmer ... I actually did some mistakes designing it with the SS pin pins connected together and not the one of the Arduino UNO to the reset pin of the target, and added a capacitor in the wrong place. I did manage to connect the pin 10 of the Arduino to the reset pin of the target on another shield and take out that capacitor. When you order one you got tens of them at the minimum ...
As the schematic is the same as the Mini, and i don't think it's needed. I know that burn in sockets already exists, but because you to reverse enginneer the pins to make it works, i prefered design my own. Ok sorry for that long introduction, but i prefered you to know the full reflexion. As you imagine, i've been searching on so many forum, tutoriels, and so ever to do it and still it doesn't work.
As it is the first time i burn a bootloader into an ATmega328P, i am not confident in what i am doing. So i tried to burn a bootloader into an Arduino Pro Mini, it works fine. I'm happy on a point : I know how to follow a step by step procedure !
The microcontroller i use (ATmega328P) is the same as the one on the Arduino Pro Mini, so the configuration in the Arduino IDE is the same. However, when the work is done easily with the Arduino Pro Mini, it doesn't work with my board. Here is what the IDE errors shows :
Arduino : 1.8.12 (Windows 10), Carte : "Arduino Pro or Pro Mini, ATmega328P (3.3V, 8 MHz)"

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files
(x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -e -
Ulock:w:0x3F:m -Uefuse:w:0xFD:m -Uhfuse:w:0xDA:m -Ulfuse:w:0xFF:m

 avrdude: Version 6.3-20190619
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Program Files
 (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

     Using Port                    : COM7
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: erasing chip
avrdude: reading input file "0x3F"
avrdude: writing lock (1 bytes):

Writing | ################################################## | 100% 0.01s

avrdude: 1 bytes of lock written
avrdude: verifying lock memory against 0x3F:
avrdude: load data lock data from input file 0x3F:
avrdude: input file 0x3F contains 1 bytes
avrdude: reading on-chip lock data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lock verified
avrdude: reading input file "0xFD"
avrdude: writing efuse (1 bytes):

Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFD:
avrdude: load data efuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip efuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDA"
avrdude: writing hfuse (1 bytes):

C:\Program Files (x86)\Arduino\hardware\tools\avr/bin/avrdude -CC:\Program Files         (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf -v -patmega328p -cstk500v1 -PCOM7 -b19200 -    Uflash:w:C:\Program Files     (x86)\Arduino\hardware\arduino\avr/bootloaders/atmega/ATmegaBOOT_168_atmega328_pro_8MHz.hex:i -    Ulock:w:0x0F:m
Writing | ################################################## | 100% 0.02s

avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDA:
avrdude: load data hfuse data from input file 0xDA:
avrdude: input file 0xDA contains 1 bytes
avrdude: reading on-chip hfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFF"
avrdude: writing lfuse (1 bytes):

Writing | ################################################## | 100% 0.03s

avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFF:
avrdude: load data lfuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip lfuse data:

Reading | ################################################## | 100% 0.01s

avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done.  Thank you.

avrdude: Version 6.3-20190619
     Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
     Copyright (c) 2007-2014 Joerg Wunsch

     System wide configuration file is "C:\Program Files     (x86)\Arduino\hardware\tools\avr/etc/avrdude.conf"

     Using Port                    : COM7
     Using Programmer              : stk500v1
     Overriding Baud Rate          : 19200
     AVR Part                      : ATmega328P
     Chip Erase delay              : 9000 us
     PAGEL                         : PD7
     BS2                           : PC2
     RESET disposition             : dedicated
     RETRY pulse                   : SCK
     serial program mode           : yes
     parallel program mode         : yes
     Timeout                       : 200
     StabDelay                     : 100
     CmdexeDelay                   : 25
     SyncLoops                     : 32
     ByteDelay                     : 0
     PollIndex                     : 3
     PollValue                     : 0x53
     Memory Detail                 :

                              Block Poll               Page                       Polled
       Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
       ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
       eeprom        65    20     4    0 no       1024    4      0  3600  3600 0xff 0xff
       flash         65     6   128    0 yes     32768  128    256  4500  4500 0xff 0xff
       lfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       hfuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       efuse          0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       lock           0     0     0    0 no          1    0      0  4500  4500 0x00 0x00
       calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
       signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

     Programmer Type : STK500
     Description     : Atmel STK500 Version 1.x firmware
     Hardware Version: 2
     Firmware Version: 1.18
     Topcard         : Unknown
     Vtarget         : 0.0 V
     Varef           : 0.0 V
     Oscillator      : Off
     SCK period      : 0.1 us

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000 (retrying)

Erreur lors de la gravure de la séquence d'initialisation.
Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x000000
avrdude: Yikes!  Invalid device signature.
     Double check connections and try again, or use -F to override
     this check.

avrdude done.  Thank you.

Something very weird is that it reads the first and second time the right signature, and it's what i understand reading the error, and then doesn't read the signature anymore. If i try to burn again the bootloader, it can't read the signature anymore. I don't know what i am missing here.
What should i do ? I'm gonna try soldering an ATmega328P directly to see if it's a problem in the socket, but i don't think it is as it is working in the first communications.
Thank you !
EDIT
Programming interface :
UNO               Target

10                RST
11                MOSI
12                MISO
13                SCK

What is your programming interface connections? Pro Mini often need the DTR pin for programming.

I do not use the DTR pin on the Pro Mini to burn the bootloader. I directly plug the reset of the pro mini (target) to the pin 10 of the UNO.

Just give it a try. DTR ensure there is a short single pulse while the timing for reset may not work, plus it could have the multiple bouncing effect. When I programming Pro Mini, reset never works while DTR will.

With the DTR pin instead of the reset pin, i get a wrong device signature changing every time, but better than nothing. It never reads 0x000000 anymore, but some random bytes : 0x0000FF or 0x000007 or 0x00FF00

The first time the fuses are still in the factory default settings. That is; internal oscillator. After setting the fuses to the values you specifies, the chip uses the external crystal. The fact that you don't get a response could indicate a problem with the crystal (or it's loading capacitors). Looking at your board it seem like you added the option to change crystals by moving jumpers. However in the picture there are no jumpers present.

I use the jumpers, but not for you to get confused with them seeing the picture, i removed all of them. I have jumpers on both sides of the 8MHz crystal as i am writting this message. So you think i should try to program it without crystals ? and you the internal one ?

The loading capacitors are 22uF, following the datasheet recommandation and the Pro Mini schematic.

It certainly does look like it's unable to clock after setting the fuses. I would suggest that crystal circuits are very sensitive and maybe the jumpers themselves are interfering with it. You could try bridging the jumpers with solder (in the underside) to bypass them. Also using an oscilloscope with the probe set to 10X to test if the crystal is actually oscillating will help.

Ok so i don't have a working 10X probe nor a 100X probe, somehow it's broken. I'm going blind on this one sorry. I think you right on that point where jumpers may interfer with the crystal. I did solder to the 8MHz crystal, because this is the one i ll mostly use in the future for power consumption. The result is that it still doesn't work with the 4 uC i use. Will try with another one, one i never touched, but not so much hope on that point.

@HugoVernier-Lambert 22uF, did you really mean that?

@Wirewrap aïe ... Thank you, I think this might be the problem. I did the full schematic back again and i wanted to put 22pF but did put 22uF ... well i go change it and see if the magic happens ! Thank you again for pointing that out !

Problem solved, i did put two capacitors way to big on the XTAL's pins, which was making the crystal unable to resonate.
Thanks to @Wirewrap for finding the mistake

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/4.0/


text:
I2C communication problem with two slaves (atlas scientific) and one Nano (official)
I'm working on a project using an arduino Nano (official) and two peripherals from Atlas Scientific (pH and DO) communicating via i2c. Everthing works fine when i use a usb alimentation connected to the PC or to a 5V adaptater (typically a phone charger).
I want to use a 12V battery and a 12V DC 1.5A adaptater to power up my system, the problem is that it works fine for a moment (30 to 40 seconds) and then the pH start having problem with the communication and the led becomes red and the TX/RX leds from the arduino (which are connected to nothing start going crazy. I use 4.7k pull up resistors and an L7805ACV voltage regulator to go from 12 to 5V.
Attach, a part of the system schematics.
If you have any clue, starting to be new idealess
EDIT : Here is the part of the program concerning the i2c communication :
#include "Wire.h"

/*********************************************************************************************************
 *                                               Address
 *********************************************************************************************************
 */
int pH_address = 99;
int DO_address = 97;

/*********************************************************************************************************
 *                                         i2C CONFIGURATION
 *********************************************************************************************************
 */

byte received_from_computer = 0;
char sensor_data[20];
byte in_char_sensor = 0;
byte j = 0;
byte code = 0;
int time_ = 850;

void setup()
{
  Wire.begin();
}
void loop()
{
  pH = Get_i2C(pH_address);
  delay(200);
  DO = Get_i2C(DO_address);
  delay(200);
}

/**********************************************************************************************************
 *                                                  i2C
 * ********************************************************************************************************
 */

float Get_i2C(int address)
{
  char computerdata = 'R';
  Wire.beginTransmission(address);
  Wire.write(computerdata);
  Wire.endTransmission();

  delay(time_);

  Wire.requestFrom(address, 16, 1);
  code = Wire.read();
  while (Wire.available())
  {
    in_char_sensor = Wire.read();
    sensor_data[j] = in_char_sensor;
    j += 1;
    if (in_char_sensor == 0)
    {
      j = 0;
      break;
    }
  }
  return atof(sensor_data);
}

Two ideas.
1: Count your grounds. If you count more than 1 you have a problem. Your system should have a single ground, so ANY connection on every component labeled GND should be connected to ground.
The reason multiple grounds are a problem is that your signals (other than differential signals) are measured relative to ground, so if two components have different ideas of what "ground" is they start to disagree about what constitutes a 1 and a 0.
2: Scope your power supply. Check that your 5V supply is still providing 5V. It's possible (although unlikely) that the L7805ACV can't supply enough current and your system is browning out. If possible have a look with an oscilloscope to check for noise on the 5V supply.
Your boards should already have decoupling capacators, but adding another won't hurt, so also try adding a 0.1uf cap between 5V and GND to eliminate any noise.

Thank you for your answer. For the first idea : every ground are connected together. For the second one, i thought about that too, so i now power my nano with the 12V for the adaptater and the two i2C are power supply with the 5V of the nano. The rest CO2 + HC05 with the 5V of the L7805ACV.

And still get the problem ... i can try adding some decoupling capacitor. Something really weird is that the TX/RX leds start to blink but nothing is connected to it, when the problem is happening.

@HugoVernier-Lambert That's really weird. All I can suggest is removing parts until you see the problem resolve. That may at least give you an idea what part may be the issue. Failing that, probe every signal. You could also provide us with a copy of your code. It doesn't sound probable, but there could be something there.

I edited the question with the i2c program.

I tried to add some decoupling capacitor, or to change from the 5V of the arduino to the 3.3V which has more decoupling capacitor already than the 5V but nothing, still the same problem.

The problem comes from the pH module (red one), but i commented the DO i2C peripheral and the pH module was working fine on any power supply. And same if i comment the pH i2C peripheral, the DO works fine. The problem is when i use it "simultanously", actually one after the other, but both wired and used by the program.

Discussing the problem with another electronic engineer, he told me that the L7805ACV was over heating making some voltage drop which were rebooting over and over the arduino. And because the TX/RX leds blink one time when rebooted at start, we see it blinking faster and faster. I'll try to get some heat sink in order to cool that voltage regulator.


text:
NRF24L01+ changing configuration after startListening
I have been trying to get two Arduino UNO talk to each other via NRF24L01's with TMRH20's NRF24 library. I tried many tutorials and examples and none of them worked. Most of them prints some error messages that's due to radio.write returning false.
After some troubleshooting I saw something weird. I set up the configuration (e.g. data rate) and when I call startListening it seems to be changed back.
This code:
void setup() {

    Serial.begin(9600);
    printf_begin();

    Serial.println("SimpleRx Starting");
    radio.begin();
    radio.setDataRate( RF24_250KBPS );
    radio.openReadingPipe(1, thisSlaveAddress);
    radio.printDetails();
    Serial.println();

    radio.startListening();
    radio.printDetails();
}

Outputs:
STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xe7e7e7e7e7 0x4141417852
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR      = 0xe7e7e7e7e7
RX_PW_P0-6   = 0x00 0x20 0x00 0x00 0x00 0x00
EN_AA        = 0x3f
EN_RXADDR    = 0x03
RF_CH        = 0x4c
RF_SETUP     = 0x27
CONFIG       = 0x0e
DYNPD/FEATURE    = 0x00 0x00
Data Rate    = 250KBPS
Model        = nRF24L01+
CRC Length   = 16 bits
PA Power     = PA_MAX

STATUS       = 0x0e RX_DR=0 TX_DS=0 MAX_RT=0 RX_P_NO=7 TX_FULL=0
RX_ADDR_P0-1     = 0xe7e7e7e7e7 0xc2c2c2c2c2
RX_ADDR_P2-5     = 0xc3 0xc4 0xc5 0xc6
TX_ADDR      = 0xe7e7e7e7e7
RX_PW_P0-6   = 0x00 0x00 0x00 0x00 0x00 0x00
EN_AA        = 0x3f
EN_RXADDR    = 0x03
RF_CH        = 0x02
RF_SETUP     = 0x0f
CONFIG       = 0x08
DYNPD/FEATURE    = 0x00 0x00
Data Rate    = 2MBPS
Model        = nRF24L01+
CRC Length   = 8 bits
PA Power     = PA_MAX

You can see that the address was set up correctly before startListening (0x4141417852) but after it reverted back to what I assume is the default value (0xc2c2c2c2c2). Data rate has also changed.
Is this normal?
The other Arduino UNO doesn't have startListening or stopListening, but if I print the configuration after openWritingPipe I see the correct configuration.

The first thing that comes to my mind is that you are powering the nrf24L01 directly from the 3V3 pin of your Arduino Uno. DO NOT do this.
The 3V3 pin does not provide enough current for the nrf24L01. This renders the module completely unstable. You can:

Use a decent capacitor across the VCC and GND on the module. (But I do not recommend going for that solution)
Use a separate 3V3 power source that is capable of handling the current spikes of the nrf24L01. But don't forget to connect its ground to the Ardino Uno aswell.
Use a power module that powers the nrf24L01 from Arduino Unos 5V rail.

Thanks, I'll try this :)

The built-in regulator might indeed be too bad, some people have measured 100mV noise which would seriously degrade how well the module works. The capacitor solution would probably give you at least some level of usability though.

This is so not true. You can absolutely power the nrf24l01 from the 3.3v out on the Arduino. I have a network of them running like this.

I ordered a power module and now they work nicely :) thanks


text:
5xWS2812B in parallel works fine in ESPHome but not in C code?
Facing a weird issue, that is probably something pretty simple, but I've went through ESPHome's code on Github and can't figure out.
I've wired up 5 WS2812B controllers on an ESP8266 (Wemos D1 R1), going from D1 to D5, controlling only 7 LEDs each.
I have the following code in ESPHome:
light:
  - platform: fastled_clockless
    chipset: WS2812B
    pin: D1
    num_leds: 7
    rgb_order: GRB
    name: "Heat #1"

  - platform: fastled_clockless
    chipset: WS2812B
    pin: D2
    num_leds: 7
    rgb_order: GRB
    name: "Heat #2"

  - repeat this 5 times, only thing changing is D1 through D5 and the name

In ESPHome, it works fine, I can control all 5 controllers no problem, both with the HTTP server and the Home Assistant API. I had done that in ESPHome to test the hardware build, since I had ESPHome already setup and it was easy.
I want to setup some Arduino code so that I don't need to depend on ESPHome (this will be a standalone project, that broadcasts an AP and has custom logic).
I have the following sample copied from FastLED's multiple controller example:
#include "FastLED.h"

#define NUM_LEDS_PER_STRIP 7
CRGB leds0[NUM_LEDS_PER_STRIP];
CRGB leds1[NUM_LEDS_PER_STRIP];
CRGB leds2[NUM_LEDS_PER_STRIP];
CRGB leds3[NUM_LEDS_PER_STRIP];
CRGB leds4[NUM_LEDS_PER_STRIP];

void setup() {
    FastLED.addLeds<WS2812B, D1, GRB>(leds0, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D2, GRB>(leds1, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D3, GRB>(leds2, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D4, GRB>(leds3, NUM_LEDS_PER_STRIP);
    FastLED.addLeds<WS2812B, D5, GRB>(leds4, NUM_LEDS_PER_STRIP);
}

void loop() {
    for(int i = 0; i < NUM_LEDS_PER_STRIP; i++) {
        leds0[i] = CRGB::Red;
        leds1[i] = CRGB::Red;
        leds2[i] = CRGB::Red;
        leds3[i] = CRGB::Red;
        leds4[i] = CRGB::Red;
        FastLED.show();
        leds0[i] = CRGB::Black;
        leds1[i] = CRGB::Black;
        leds2[i] = CRGB::Black;
        leds3[i] = CRGB::Black;
        leds4[i] = CRGB::Black;
        delay(100);
    }
}

With this one, I can only control 3 lights: D1, D2 and D5. I've attached a picture of what it looks like. The other 2 just stays white.
https://i.sstatic.net/zIrkR.jpg
I'm most likely missing something simple that ESPHome is doing that I am not. It's a long shot, but anyone has a clue?

is it on the same esp8266 module.board?

Same board, yep. I should specify that it's a Wemos D1 R1 dev kit. I don't even disconnect anything, just keep USB plugged in, flash another firmware.

are D pins the same pins?  D1 R1 has different D pins to io pins mapping then R2 or NodeMcu (which have the same) R1: https://github.com/esp8266/Arduino/blob/8dd068eb40b4214f0ba81413d8888ae825e1d0f4/variants/d1/pins_arduino.h#L38 R2 https://github.com/esp8266/Arduino/blob/8dd068eb40b4214f0ba81413d8888ae825e1d0f4/variants/d1_mini/pins_arduino.h#L37. what board did you select in Tools menu?

@Juraj, that was totally it! Looks like my board is a d1_mini variant! Odd as it gets detected as a D1 R1.

so there is a big difference how the mini and the R1/R2 look like. the R2 and mini have the same pin mapping.


text:
What Ohm Termination Resistor is needed for this schema ? What, Where and How?
I'm building a Master-Slave system using some arduino pro mini as slaves and a Mega 2560 as Master to communicate over RS485 config via MAX485. Since i'm newbie in RS485 i know that i need to put some termination resistor somewhere is the line but i don't know where and how, also i don't know how much ohm should it be. My Baud rate is 9600 and i'm using twisted pair cable (CAT5) and it's 120 meters long.
UPDATE 1:
My goal is to get data from each slave time to time, every slave is connected to a temperature sensor and sends temperature value to master on demand (when master asks for it.) The master asks for temperature value from all slaves separately (of course!) and repeatedly every 500 ms. First it asks slave 1 to send data and then slave 1 sends data to master, then master asks slave 2 to send data and slave 2 sends data to master and so on. after 500 ms, it does this again.

UPDATE 2:
Master side code (Mega 2560):
#include <AltSoftSerial.h>
#define DE 2 //RS485 Data enable pin. HIGH=Transmit, LOW=Receive
String inputS = "";
boolean stringComplete = false;
AltSoftSerial altSerial;

void setup() {
 altSerial.begin(9600);
 Serial.begin(9600);
 pinMode(DE, OUTPUT);
}

void loop() {
 digitalWrite(DE, HIGH); //Transmit
 altSerial.println("MEGA:ProMini1");
 altSerial.flush();
 digitalWrite(DE, LOW); //Receive
 CheckAndReceiveFromMax(); //Check if data received
 if(stringComplete){
   inputS.trim();
   if(inputS.equals("ProMini1:ACK"))
    Serial.println("MEGA: ProMini1 Acknowledged: " + inputS);
   else
    Serial.println("MEGA: Not valid On ProMini1: " + inputS);
   stringComplete = false;
   inputS = "";
 }
delay(100);
digitalWrite(DE, HIGH); //Transmit
altSerial.println("MEGA:ProMini2");
altSerial.flush();
digitalWrite(DE, LOW); //Receive
CheckAndReceiveFromMax();
if(stringComplete){
  inputS.trim();
  if(inputS.equals("ProMini2:ACK"))
    Serial.println("MEGA: ProMini2 Acknowleged: " + inputS);
  else
    Serial.println("MEGA: Not valid On ProMini2: " + inputS);
  stringComplete = false;
  inputS = "";
}
delay(500);
}

void CheckAndReceiveFromMax()
{
 while (altSerial.available()) {
 char inChar = (char)altSerial.read();
 inputS1 += inChar;
 if (inChar == '\n')
  stringComplete1 = true;
 }
}

Slave side code (Pro Mini1):
#include <AltSoftSerial.h>
#define DE 7
String inputS = "";
boolean stringComplete = false;
AltSoftSerial altSerial;

void setup() {
 altSerial.begin(9600);
 Serial.begin(9600);
 pinMode(DE, OUTPUT);
}

void loop() {
 digitalWrite(DE, LOW); //Receive
 CheckAndReceiveFromMax(); //Check if data received
 if(stringComplete){
  Serial.print("String received: ");
  inputS.trim();
  Serial.println(inputS);
  if(inputS.equals("MEGA:ProMini1")){
   Serial.println("ProMini1: Mega called me!");
   digitalWrite(DE, HIGH); //Transmit
   altSerial.println("ProMini1:ACK");
   altSerial.flush();
   digitalWrite(DE, LOW);
  }
 stringComplete = false;
 inputS = "";
 }
}

void CheckAndReceiveFromMax()
{
 while (altSerial.available()) {
 char inChar = (char)altSerial.read();
 inputS += inChar;
 if (inChar == '\n')
  stringComplete1 = true;
 }
}

And the same code for ProMini2, ProMini3 and so on.
OUTPUTS:
When master calls ProMini1, the ProMini2 answers, and when master calls ProMini2, ProMini1 aswers. Also, received data is not always in correct format.
Server Serial Monitor:
 MEGA: Not valid On ProMini1:  roMini1:ACK
  :
MEGA: Not valid On ProMini2: ProMini1:ACK
MEGA: Not valid On ProMini1:  roMini1:ACK

MEGA: Not valid On ProMini2: ProMini1:ACK

MEGA: Not valid On ProMini2:  roMini1:ACK

.
.
.

are you supplying power through the cable? if yes, what is the power voltage at each arduino?

in this schematic yes, but in test environment i used short wire for power supply for each node, but i considered common ground. 5v

remove the ground connections. if the cable is shielded, then connect the shield to ground at one place only. .... have you tested your devices by connecting them a short distance apart? (all on the same bench, for example)

i tested it with short wire just between 1 master and 1 slave and worked properly

Please try it on short wires with all slaves.

why would you not test multiple slave devices? ... how do you even know that your software works correctly? ... you are making assumptions. there is an old saying when you assume, you make an ass of u and me ... lol

You should find your answer here: https://www.maximintegrated.com/en/app-notes/index.mvp/id/763

@Majenko and dear jsotola:
Question Updated

Why are you using software serial on a mega...?

@Majenko: Does it matter ? I can use hardware serial, but no difference

Software serial (of any form) is frowned upon and only used as a last resort.

You might want to take a look at my ICSC library. It's designed for just this kind of environment. https://github.com/MajenkoLibraries/ICSC

@Majenko: your library seems great but there is no tutorial of how to use it and the function list. Can you give me a link of it if exists ? thanks.

@SafaSeed The examples show the use of pretty much all the functions. There's not many. You can find them in the header file near the bottom.

@Majenko if you mean "PingMaster", "PingSlave", "RemoteLEDReceiver" and "RemoteLEDSender" they don't give me of how can i use it in my rs485 bus. For example nowhere in the code DE pin of MAX485 is mentioned! Im totally confused

@SafaSeed Here is an old wiki page - some things may have changed slightly, but not much: https://sourceforge.net/p/arduino-icsc/wiki/Home/

@Majenko:
Please answer to this question:
https://arduino.stackexchange.com/questions/47748/problem-using-icsc-by-majenkotech-in-rs485-bus

For low data speeds, like 9600bps, termination is usually not necessary.

But i cannot get correct data. it works properly when there is just one master and one slave, but as i add a new slave the data received by both master and slaves are incorrect

Your problem may or may not be related to termination. If you revise your question to include more information about what you expect to see, and what you see instead, as well as more information about your setup, such as an example of your code for communication, someone may spot some other solution. See also https://meta.stackexchange.com/questions/66377/what-is-the-xy-problem

Question updated :)

So what does the incorrect data look like? Do you get some answer with wrong values? What values do you send and expect to receive?

Question Updated

try 120ohm carbon resistor, not wirewound, at each end of the line ( two resistors in total)

license: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
WS2811 LEDs have the wrong color unless I touch the data wire
This is an electrical/hardware issue, but for background, here's my setup:
I'm using a Wemos D1 mini
in conjunction with Home Assistant running on a RPi3.  The MQTT setup works fine and the commands are being executed perfectly, but the colors are completely off unless I'm touching the data wire.
For instance, if I request solid blue and am touching the wire, they all turn blue.  If I let go of the wire, the first LED turns red and the rest are a strong green.  If I touch the wire, they go back to blue.
Any colors or patterns requested show likewise confusing changes.
What kind of effect is causing this, and what can I do to fix it?
Using a Tanbaby 5V 60A for power
Lights are Alitove WS2811 5V 12mm RGBs

I am having the same issue, I put a Capacitor in the right place and I also put the resistor in line, and when I put the resistor inline it does not work at all. Any other feedback on this?

It sounds like the bits are getting garbled. There is more than one wire, which one do you mean? Data? Earth? Power?
From the Adafruit NeoPixels best practices guide:

Before connecting NeoPixels to any large power source (DC “wall wart” or even a large battery), add a capacitor (1000 µF, 6.3V or higher) across the + and – terminals.
Place a 300 to 500 Ohm resistor in series between the Arduino data output pin and the input to the first NeoPixel. This resistor must be at the NeoPixel end of the wire to be effective!
Try to minimize the distance between the Arduino and first pixel.
Avoid connecting NeoPixels to a live circuit. If you simply must, always connect ground first, then +5V, then data. Disconnect in the reverse order.
If powering the pixels with a separate supply, apply power to the pixels before applying power to the microcontroller.

I agree that it's an issue of mangled bits, but how does touching the data wire "fix" that.  Skipping the capacitor advise for now, as it's manifesting as a data issue.  Tried adding a resistor, but that eliminates the signal altogether.  The data wire is only 4 inches, soldered into the board and clipped to the led data input.

your body is adding capacitance to whatever it touches

What is supplying the data? The Pi? The ESP8266? What voltage are you running at? The Neopixels require 5V as I recall. If you are running at 3.3V the performance may be marginal.

The ESP8266 is supplying the signal.  The lights are more "christmas light"-style, they're not Neopixels.

Yes, well Adafruit call them Neopixels. They may not be technically the Neopixel "brand" but Neopixels use the WS2811 chip (amongst others).

What voltage are you powering the WS2811 chips at?

And, what is the data voltage? 3.3V or 5V?

The GND on the ESP8266 should be tied to the DC- from your power supply.   With your short signal wire, you can do it at either end; on longer runs, it's recommended to run a twisted pair of GND & Signal and tie GND to DC- at the first pixel.

all_licenses: Creative Commons - Attribution Share-Alike - https://creativecommons.org/licenses/by-sa/3.0/


text:
How can I modify Arduino code to work with ATtiny85?
Push a tactile switch to cycle through several different patterns on the LED strips. I want to modify the Arduino code so that I can use the ATtiny85 instead.
*****The code posted here works on the Arduino Uno with a 10k pull-up resistor wired to the push button at pin 11 on the Arduino.
/***************************************************************************/
//            Hardware: RadioShack Tricolor LED Strip
//            Arduino IDE: Arduino-1.0
//            Date:      April 17, 2013
//            Copyright© 2013 RadioShack Corporation
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library 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
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, see <http://www.gnu.org/licenses/>
//
/*****************************************************************************/

#include <avr/pgmspace.h>

// ******** DEBUG ==== should auto config to adapt different mother board *********
#define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO
#define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO
#define STRIP_PINOUT (DDRC=0xFF)    // for UNO

int val = 0; //variable to read button pin value
int buttonPin = 11; //button pin variable, 11 on the Arduino
int sequence = 1; //variable to hold current sequence

PROGMEM const unsigned long pattern_test_blue_comet_red_bg[][20] = {
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},

};

PROGMEM const unsigned long pattern_test_disco[][20] = {
  {0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011},
  {0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022},
  {0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033},
  {0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044},
  {0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055},
  {0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066},
  {0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077},
  {0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088},
  {0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099},
  {0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa},
  {0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb},
  {0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc},
  {0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd},
  {0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000},
  {0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000},
  {0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000},
  {0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000},
  {0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000},
  {0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000},
  {0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000},
  {0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000},
  {0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000},
  {0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000},
  {0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000},
  {0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000},
  {0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000},
  {0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000},
  {0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000},
  {0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100},
  {0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200},
  {0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300},
  {0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400},
  {0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500},
  {0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600},
  {0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700},
  {0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800},
  {0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900},
  {0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00},
  {0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00},
  {0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00},
  {0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00},
  {0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00},
  {0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00},
};

PROGMEM const unsigned long pattern_test_pink[][20] = {
  {0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff},
};

PROGMEM const unsigned long pattern_test_purple[][20] = {
  {0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66},
};

PROGMEM const unsigned long pattern_test_blue[][20] = {
  {0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00},
};

PROGMEM const unsigned long pattern_test_green[][20] = {
  {0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000},
};

PROGMEM const unsigned long pattern_test_yellow[][20] = {
  {0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff},
};

PROGMEM const unsigned long pattern_test_white[][20] = {
  {0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff},
};

PROGMEM const unsigned long pattern_test_red[][20] = {
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
};

// ***********************************************************************************************************
// *
// *                            Power Up Init.
// *
// *
// ***********************************************************************************************************
void setup() {

  STRIP_PINOUT;        // set output pin - DEBUG: should auto detect which mother board for use

  reset_strip();
  //noInterrupts();

}

// ***********************************************************************************************************
// *
// *                            Main Loop
// *
// *
// ***********************************************************************************************************
void loop()
{

  val = digitalRead(buttonPin);
  if (val == LOW)
  {
    if (sequence == 9)
    {
      sequence = 1;
    } else
    {
      sequence++;
    }
    delay(200);
  }

  switch (sequence)
  {
    case 1:
      send_1M_pattern(pattern_test_pink, 1, 5);
      delay(1);
      break;
    case 2:
      send_1M_pattern(pattern_test_purple, 1, 5);
      delay(1);
      break;
    case 3:
      send_1M_pattern(pattern_test_blue, 1, 5);
      delay(1);
      break;
    case 4:
      send_1M_pattern(pattern_test_green, 1, 5);
      delay(1);
      break;
    case 5:
      send_1M_pattern(pattern_test_yellow, 1, 5);
      delay(1);
      break;
    case 6:
      send_1M_pattern(pattern_test_white, 1, 5);
      delay(1);
      break;
    case 7:
      send_1M_pattern(pattern_test_red, 1, 5);
      delay(1);
      break;
    case 8:
      send_1M_pattern(pattern_test_blue_comet_red_bg, 43, 45);
      delay(1);
      break;
    case 9:
      send_1M_pattern(pattern_test_disco, 45, 5);
      delay(1);
      break;
  }

  //delay(1);
}

/*******************************************************************************
   Function Name  : send_1M_pattern
   Description    : Transmit pattern to whole 1 meter strip
   Input          : pointer to ROM pattern; pattern length; frame rate
   Output         : None
   Return         : None
 *******************************************************************************/
void send_1M_pattern(const unsigned long data[][20], int pattern_no, int frame_rate)
{
  int i = 0;
  int j = 0;
  uint32_t temp_data;

  for (i = 0; i < pattern_no; i++)
  {
    noInterrupts();
    for (j = 0; j < 20; j++)
    {
      temp_data = pgm_read_dword_near(&data[i][j]);
      send_strip(temp_data);
    }
    interrupts();

    delay(frame_rate);

  }
}

/*******************************************************************************
   Function Name  : send_strip
   Description    : Transmit 24 pulse to LED strip
   Input          : 24-bit data for the strip
   Output         : None
   Return         : None
 *******************************************************************************/
void send_strip(uint32_t data)
{
  int i;
  unsigned long j = 0x800000;

  for (i = 0; i < 24; i++)
  {
    if (data & j)
    {
      DATA_1;
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");

      /*----------------------------*/
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      /*----------------------------*/
      DATA_0;
    }
    else
    {
      DATA_1;
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      DATA_0;
      /*----------------------------*/
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      __asm__("nop\n\t");
      /*----------------------------*/
    }

    j >>= 1;
  }
}

/*******************************************************************************
   Function Name  : reset_strip
   Description    : Send reset pulse to reset all color of the strip
   Input          : None
   Output         : None
   Return         : None
 *******************************************************************************/
void  reset_strip()
{
  DATA_0;
  delayMicroseconds(20);
}

Comments are not for extended discussion; this conversation has been moved to chat.

Try replacing the lines
#define DATA_1 (PORTC |=  0X01)    // DATA 1    // for UNO
#define DATA_0 (PORTC &=  0XFE)    // DATA 0    // for UNO
#define STRIP_PINOUT (DDRC=0xFF)    // for UNO
int buttonPin = 11; //button pin variable, 11 on the Arduino

with
#define DATA_1 (PORTB |=  0X01)    // DATA 1    // on PB0
#define DATA_0 (PORTB &=  0XFE)    // DATA 0    // on PB0
#define STRIP_PINOUT (DDRB=0x01)    // PB0 as output
int buttonPin = 3; //button pin variable, pin 3 = PB3

Connect the push button between PB3 and GND, with an external pullup.
Connect PB0 to the data input of the LED strip.
If the program doesn't fit in the flash, try removing one of the largest
patterns. Otherwise, if it almost fits, you could try to optimize it to
make it smaller.

Edit: I modified the original code and added some optimizations.
Notably, I removed all dependencies to the Arduino core, which makes it
significantly smaller. Now it fits in the flash memory of the ATtiny85
without removing any pattern.
This is a polyglot: it should compile either as a .ino sketch, as a
plain C program, or as a C++ program.
Here is the code:
/***************************************************************************/
//            Hardware: RadioShack Tricolor LED Strip
//            Arduino IDE: Arduino-1.0
//            Date:      April 17, 2013
//            Copyright© 2013 RadioShack Corporation
//
//  This library is free software; you can redistribute it and/or
//  modify it under the terms of the GNU Lesser General Public
//  License as published by the Free Software Foundation; either
//  version 2.1 of the License, or (at your option) any later version.
//
//  This library 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
//  Lesser General Public License for more details.
//
//  You should have received a copy of the GNU Lesser General Public
//  License along with this library; if not, see <http://www.gnu.org/licenses/>
//
/*****************************************************************************/
// Modified to work on an ATtiny85 by Edgar Bonet -- 2017-12-12.
//
// Wiring:
//   - connect a push button between PB3 and GND
//   - connect PB0 to the data input of the LED strip
//
// Compile:
//   avr-gcc -mmcu=attiny85 -Os -Wall -Wextra -DF_CPU=8000000
//   Tricolor-LED-Strip.c -o Tricolor-LED-Strip.elf
/*****************************************************************************/

#include <avr/pgmspace.h>
#include <avr/io.h>
#include <avr/interrupt.h>
#include <util/delay.h>

// Change this if you want to use different pins.
#define DATA_PIN   PB0
#define BUTTON_PIN PB3

void send_1M_pattern(const unsigned long data[][20], uint8_t pattern_no, uint8_t frame_rate);
void send_strip(uint32_t data);
void reset_strip();

static void short_delay(uint8_t ms)
{
  while (ms--) _delay_ms(1);
}

PROGMEM const unsigned long pattern_test_blue_comet_red_bg[][20] = {
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100, 0x00ff00},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x001100},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x0000ff, 0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x00ff00, 0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x001100, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},

};

PROGMEM const unsigned long pattern_test_disco[][20] = {
  {0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011, 0x000011},
  {0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022, 0x000022},
  {0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033, 0x000033},
  {0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044, 0x000044},
  {0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055, 0x000055},
  {0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066, 0x000066},
  {0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077, 0x000077},
  {0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088, 0x000088},
  {0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099, 0x000099},
  {0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa, 0x0000aa},
  {0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb, 0x0000bb},
  {0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc, 0x0000cc},
  {0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd, 0x0000dd},
  {0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee, 0x0000ee},
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
  {0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000, 0x110000},
  {0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000, 0x220000},
  {0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000, 0x330000},
  {0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000, 0x440000},
  {0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000, 0x550000},
  {0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000, 0x660000},
  {0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000, 0x770000},
  {0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000, 0x880000},
  {0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000, 0x990000},
  {0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000, 0xaa0000},
  {0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000, 0xbb0000},
  {0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000, 0xcc0000},
  {0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000, 0xdd0000},
  {0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000, 0xee0000},
  {0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000},
  {0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100, 0x001100},
  {0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200, 0x002200},
  {0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300, 0x003300},
  {0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400, 0x004400},
  {0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500, 0x005500},
  {0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600, 0x006600},
  {0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700, 0x007700},
  {0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800, 0x008800},
  {0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900, 0x009900},
  {0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00, 0x00aa00},
  {0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00, 0x00bb00},
  {0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00, 0x00cc00},
  {0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00, 0x00dd00},
  {0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00, 0x00ee00},
  {0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00},
};

PROGMEM const unsigned long pattern_test_pink[][20] = {
  {0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff, 0x00ffff},
};

PROGMEM const unsigned long pattern_test_purple[][20] = {
  {0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66, 0x00cc66},
};

PROGMEM const unsigned long pattern_test_blue[][20] = {
  {0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00, 0x00ff00},
};

PROGMEM const unsigned long pattern_test_green[][20] = {
  {0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000, 0xff0000},
};

PROGMEM const unsigned long pattern_test_yellow[][20] = {
  {0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff, 0xff00ff},
};

PROGMEM const unsigned long pattern_test_white[][20] = {
  {0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff, 0xffffff},
};

PROGMEM const unsigned long pattern_test_red[][20] = {
  {0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff, 0x0000ff},
};

static const struct {
  const unsigned long (*data)[20];
  uint8_t pattern_no;
  uint8_t frame_rate;
} patterns[9] = {
  {pattern_test_pink, 1, 5},
  {pattern_test_purple, 1, 5},
  {pattern_test_blue, 1, 5},
  {pattern_test_green, 1, 5},
  {pattern_test_yellow, 1, 5},
  {pattern_test_white, 1, 5},
  {pattern_test_red, 1, 5},
  {pattern_test_blue_comet_red_bg, 43, 45},
  {pattern_test_disco, 45, 5}
};

// ***********************************************************************************************************
// *
// *                            Main Program
// *
// *
// ***********************************************************************************************************
int main(void)
{
  uint8_t sequence = 0; //variable to hold current sequence

  DDRB |= _BV(DATA_PIN);     // DATA_PIN as output
  PORTB |= _BV(BUTTON_PIN);  // internal pullup on button pin
  reset_strip();

  for (;;) {
    if ((PINB & _BV(BUTTON_PIN)) == 0) {  // if the button is pressed
      if (++sequence == 9)
        sequence = 0;
      short_delay(200);
    }
    send_1M_pattern(
      patterns[sequence].data,
      patterns[sequence].pattern_no,
      patterns[sequence].frame_rate
    );
    short_delay(1);
  }
}

/*******************************************************************************
   Function Name  : send_1M_pattern
   Description    : Transmit pattern to whole 1 meter strip
   Input          : pointer to ROM pattern; pattern length; frame rate
   Output         : None
   Return         : None
 *******************************************************************************/
void send_1M_pattern(const unsigned long data[][20], uint8_t pattern_no, uint8_t frame_rate)
{
  int i = 0;
  int j = 0;
  uint32_t temp_data;

  for (i = 0; i < pattern_no; i++)
  {
    for (j = 0; j < 20; j++)
    {
      temp_data = pgm_read_dword_near(&data[i][j]);
      send_strip(temp_data);
    }

    short_delay(frame_rate);

  }
}

/*******************************************************************************
   Function Name  : send_strip
   Description    : Transmit 24 pulse to LED strip
   Input          : 24-bit data for the strip
   Output         : None
   Return         : None
 *******************************************************************************/
void send_strip(uint32_t data)
{
  int i;
  unsigned long j = 0x800000;

  for (i = 0; i < 24; i++)
  {
    if (data & j)
    {
      PORTB |= _BV(DATA_PIN);
      _delay_us(1.75);
      PORTB &= ~_BV(DATA_PIN);
    }
    else
    {
      PORTB |= _BV(DATA_PIN);
      _delay_us(0.563);
      PORTB &= ~_BV(DATA_PIN);
      _delay_us(0.188);
    }

    j >>= 1;
  }
}

/*******************************************************************************
   Function Name  : reset_strip
   Description    : Send reset pulse to reset all color of the strip
   Input          : None
   Output         : None
   Return         : None
 *******************************************************************************/
void  reset_strip()
{
  PORTB &= ~_BV(DATA_PIN);
  _delay_us(20);
}

Comments are not for extended discussion; this conversation has been moved to chat.