/* ==============================================================================================================================================================================================
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
INCLUDE
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
==============================================================================================================================================================================================
*/
/* IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
INCLUDE - LED LPD6803
IIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIII
*/
#include <TimerOne.h> // I Dont think this is needed.
#include "LPD6803.h"
// Example to control LPD6803-based RGB LED Modules in a strand
// Original code by Bliptronics.com Ben Moyes 2009
// Use this as you wish, but please give credit, or at least buy some of my LEDs!
// Code cleaned up and Object-ified by ladyada, should be a bit easier to use
/*****************************************************************************/
// Choose which 2 pins you will use for output.
// Can be any valid output pins.
int dataPin = 2; // 'yellow' wire
int clockPin = 3; // 'green' wire
// Don't forget to connect 'blue' to ground and 'red' to +5V
// Timer 1 is also used by the strip to send pixel clocks
// Set the first variable to the NUMBER of pixels. 20 = 20 pixels in a row
LPD6803 strip = LPD6803(50, dataPin, clockPin);
/* ==============================================================================================================================================================================================
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SETUP
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
==============================================================================================================================================================================================
*/
void setup() {
/* SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SETUP - GPIO Hardware Input/Output Devices
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
*/
/* SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
SETUP - LPD6803
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSSS
*/
// The Arduino needs to clock out the data to the pixels
// this happens in interrupt timer 1, we can change how often
// to call the interrupt. setting CPUmax to 100 will take nearly all all the
// time to do the pixel updates and a nicer/faster display,
// especially with strands of over 100 dots.
// (Note that the max is 'pessimistic', its probably 10% or 20% less in reality)
strip.setCPUmax(50); // start with 50% CPU usage. up this if the strand flickers or is slow
// Start up the LED counter
strip.begin();
// Update the strip, to start they are all 'off'
strip.show();
//Serial.begin(9600); // CAN NOT RUN SERIAL with CODE. MUST COMMENT OUT FOR THE LED'S TO WORK
/*
Serial.println("Start");
Serial.println(Color(255, 255, 255)); // = 32767
Serial.println(Color(127, 127, 127)); // = 32767 MAX VALUE for each color. Anything over 127 will give the same result.
Serial.println(Color(126, 127, 127)); // = 32766
Serial.println(Color(99, 99, 99)); // = 03171
Serial.println(Color(00, 00, 60)); // = 28672
Serial.println(Color(00, 63, 00)); // = 992
Serial.println(Color(63, 00, 00)); // = 31
Serial.println(Color(90, 00, 00)); // = 26
*/
}
/* ==============================================================================================================================================================================================
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
LOOP
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
==============================================================================================================================================================================================
*/
void loop() {
/* LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
LOOP - Basic LED Send out values.
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
*/
// strip.setPixelColor accepts 2 formats:
// strip.setPixelColor(Cell Number, Decimal number)
// strip.setPixelColor(Cell Number, Blue, Green, Red) // Value UP TO 127 accepted.
strip.setPixelColor(0, 32767); // setPixelColor take the 5 digit bit, combines it will 0 to create the 6th multiple.
//strip.setPixelColor(1, 896);
strip.setPixelColor(1, 127, 0, 0); // BLUE GREEN RED, in that order. Cause it is silly.
strip.setPixelColor(2, 0, 90, 0); // = Green
strip.setPixelColor(3, 0, 00, 90); // = RED
strip.setPixelColor(4, 0, 00, 90);
strip.setPixelColor(5, 0, 00, 90);
strip.setPixelColor(6, 0, 00, 90);
strip.setPixelColor(7, 0, 00, 90);
strip.setPixelColor(41, 0, 110, 127);
strip.setPixelColor(42, 0, 110, 127);
strip.setPixelColor(43, 0, 110, 127);
strip.setPixelColor(23, 0, 00, 90);
// strip.setPixelColor(1, Color(25, 06, 00));
//strip.setPixelColor(2, Color(25, 25, 25));
//strip.show();
/* LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
LOOP - Basic LED Send out values.
LLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLL
*/
}
// BELOW is not needed.
unsigned int Color(byte r, byte g, byte b)
{
//Take the lowest 5 bits of each value and append them end to end
return ( ((unsigned int)b & 0x1F ) << 10 | ((unsigned int)g & 0x1F) << 5 | (unsigned int)r & 0x1F);
}
/* //////// LPD6803.h Looks like this: /////////////
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
class LPD6803 {
private:
uint8_t cpumax;
public:
LPD6803(uint16_t n, uint8_t dpin, uint8_t cpin);
void begin();
void show();
void doSwapBuffersAsap(uint16_t idx);
void setPixelColor(uint16_t n, uint8_t r, uint8_t g, uint8_t b);
void setPixelColor(uint16_t n, uint16_t c);
void setCPUmax(uint8_t m);
uint16_t numPixels(void);
};
*/
If I un-comment the Serial.begin(). The LED strip will no longer output signal to the LPD6803 led strip I have.
Can anyone look over and see why there might be a conflict? The code is at bare minimum as shown. So not much is going on.