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);
}