ColorWipe for LPD8806

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Re: ColorWipe for LPD8806

Postby Jasonmorris » Wed May 09, 2012 9:27 am

We would very much like the LPD8806 and the breadboard to be synchronized.

But we are not sure how to do it. If you could point us in the right direction we will be very happy.
Jasonmorris
 
Posts: 9
Joined: Mon Apr 30, 2012 5:20 am

Re: ColorWipe for LPD8806

Postby adafruit_support_bill » Wed May 09, 2012 10:13 am

We would very much like the LPD8806 and the breadboard to be synchronized.

So, you need to identify at what points in the LPD8806 sequence your traffic lights need to change, and break the code for that sequence up into parts. Then you insert code for the traffic light changes between the parts:

led-sequence part 1
traffic light change 1
led-sequence part 2
traffic light change 2
led-sequence part 3
traffic light change 3
etc...
User avatar
adafruit_support_bill
 
Posts: 16617
Joined: Sat Feb 07, 2009 9:11 am

Re: ColorWipe for LPD8806

Postby adafruit_support_rick » Wed May 09, 2012 4:16 pm

If I'm following this correctly, adafruit_support's suggestion might not work the way you want, since you are using delays to control how long each traffic light is lit. If you follow the suggestion, then you will have those delays in between your led color wipe sequences.

A better way to look at it might be like this:
ColorWipe2 takes an argument, 'wait', that controls how fast you sweep through the LPD8806. Looks like you are passing it a value of 500ms.

So, your loop updates a couple of LEDs, then waits for 500ms, then updates the next LEDs, then waits again, right?

That means that you can think of your loop-counter as a time value:
i = 0 is 0ms
i = 1 is 500ms
i = 2 is 1000ms
etc.

So, instead of turning your traffic lights on and off in a separate block of code, you can turn them on and off right inside of your loop. Something like this:

Code: Select all
for (i=strip.numPixels()/2; i >= 0; i-=2) {
strip.setPixelColor(i, c2); // grøn
strip.setPixelColor(i + 1, c2); // grøn
strip.setPixelColor(i + strip.numPixels()/2, c1); //rød
strip.setPixelColor(i + (1) + strip.numPixels()/2, c1);  // rød
strip.show();
if (i == 0) {
  digitalWrite(gul, HIGH);
}
if (i == 2) {
  digitalWrite(gul, LOW);
  digitalWrite(rod, HIGH);
}
if (i == 16) {
  digitalWrite(rod, LOW);
}
delay(wait);
}
User avatar
adafruit_support_rick
 
Posts: 3139
Joined: Tue Mar 15, 2011 10:42 am
Location: Buffalo, NY

Previous

Return to Glowy things (LCD, LED, TFT, EL) purchased at Adafruit

Who is online

Users browsing this forum: No registered users and 1 guest

Stuff to buy from the Adafruit store and links to product documentation!


New Products [114]

Raspberry Pi[82]
 
FLORA[24]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[12]
Arduino[60]
 
NETduino[14]
 
BeagleBone[23]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[39]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[9]


 
Breakout Boards[35]
LCDs & Displays[49]
Components & Parts[70]
Batteries & Power[54]
EL Wire/Tape/Panel[52]
LEDs[112]
 
Wireless[16]
Cables[66]
 
Lasers[6]
Sensors/Parts[147]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[70]
 
iDevices[13]
Tools[71]
 
Wearables[41]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[25]


 
Stickers[41]
 
Skill badges[55]
 
Books[26]
 
Circuit Playground[7]
 
Gift Certificates[4]