Fork of AndyA/cylon, with support for STM32F4 and LPC8xx
Fork of cylon by
Diff: main.cpp
- Revision:
- 2:c658370b1a08
- Parent:
- 1:054df9ecd479
--- a/main.cpp Fri Nov 07 16:28:27 2014 +0000 +++ b/main.cpp Sat Dec 10 14:25:55 2016 +0000 @@ -1,19 +1,17 @@ #include "mbed.h" #include "wsDrive.h" +DigitalOut led1(LED1); + // time period between each movement -#define updatePeriodMS 15 +#define updatePeriodMS 10 // number of LEDs in chain -#define chainLen 144 +#define chainLen 300 // set the pulldown and then create the driver -DigitalIn dummy(P0_21,PullDown); -wsDrive ledDriver(P0_21,P0_22,P1_15); - -// mbuino stnadard definitions -DigitalIn progMode(P0_3,PullDown); // fix the power wasted if we ever sleep. -BusOut LEDs(LED1, LED2, LED3, LED4, LED5, LED6, LED7); // control the LEDs +//wsDrive ledDriver(P1_22, P0_22, P1_15); +wsDrive ledDriver(PC_12, NC, NC); Timer updateRateTimer; @@ -74,9 +72,9 @@ for (int pixel = 0; pixel < len; pixel++) { if (add) - addPixel((buffer+pixelToUpdate), colour, 1.0 - (float)pixel/(float)len); + addPixel((buffer+pixelToUpdate), colour, 1.0f - (float)pixel/(float)len); else - subtractPixel((buffer+pixelToUpdate), colour, 1.0 - (float)pixel/(float)len); + subtractPixel((buffer+pixelToUpdate), colour, 1.0f - (float)pixel/(float)len); increasing ? pixelToUpdate-- : pixelToUpdate++; @@ -104,36 +102,38 @@ int main () { - LEDs = 0; + //LEDs = 0; // set up the lights. lines[0].start = 0; - lines[0].speed = 1.1; - lines[0].length = 20; + lines[0].speed = 1.6; + lines[0].length = 30; lines[0].backgroundRatio = 40; - lines[0].colour.R = 120; + lines[0].colour.R = 200; lines[0].colour.G = 0; lines[0].colour.B = 0; lines[0].dir = true; - lines[1].start = 0; - lines[1].speed = 2.0/3.0; - lines[1].length = 16; +#if 1 + lines[1].start = 150; + lines[1].speed = 1.4; + lines[1].length = 30; lines[1].backgroundRatio = 40; lines[1].colour.R = 0; lines[1].colour.G = 0; - lines[1].colour.B = 120; + lines[1].colour.B = 200; lines[1].dir = true; - lines[2].start = 143; - lines[2].speed = 1; - lines[2].length = 20; + lines[2].start = 299; + lines[2].speed = 1.1; + lines[2].length = 30; lines[2].backgroundRatio = 40; lines[2].colour.R = 0; - lines[2].colour.G = 120; + lines[2].colour.G = 200; lines[2].colour.B = 0; lines[2].dir = false; +#endif // clear the buffer blankBuffer(pixelData); @@ -154,13 +154,14 @@ // give the LED driver the buffer to use. ledDriver.setData(pixelData, chainLen); - LEDs = 1; + //LEDs = 1; updateRateTimer.start(); while (true) { ledDriver.sendData(); // send the LED data - LEDs = LEDs+1; + led1 = !led1; + //LEDs = LEDs+1; // subtract the current trail locations and then add the new locations. for (int j = 0; j <trailCount; j++) {