![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
A project that aims at making a LED based light system controlled by microcontroller and with BLE (soon) with smooth color transitions.
Diff: main.cpp
- Revision:
- 3:25af55580ef6
- Parent:
- 2:0bbd4fc5e202
diff -r 0bbd4fc5e202 -r 25af55580ef6 main.cpp --- a/main.cpp Fri Aug 18 11:26:01 2017 +0000 +++ b/main.cpp Tue Feb 13 15:36:17 2018 +0000 @@ -2,18 +2,18 @@ #include "LEDManager.h" Timer timer; -Serial pc(USBTX,USBRX,921600); +Serial pc(USBTX,USBRX/*,921600*/); -LEDManager *led1 = new LEDManager(D11,10000); -LEDManager *led2 = new LEDManager(D4,10000); -LEDManager *led3 = new LEDManager(D7,10000); -LEDManager *led4 = new LEDManager(D5,10000); -LEDManager *led5 = new LEDManager(D6,10000); -LEDManager *led6 = new LEDManager(D12,10000); -LEDManager *led7 = new LEDManager(D8,10000); -LEDManager *led8 = new LEDManager(D9,10000); -LEDManager *led9 = new LEDManager(D10,10000); +LEDManager *l1g = new LEDManager(D11,10000); +LEDManager *l1b = new LEDManager(D4,10000); +LEDManager *l1r = new LEDManager(D7,10000); +LEDManager *l2r = new LEDManager(D5,10000); +LEDManager *l2g = new LEDManager(D6,10000); +LEDManager *l2b = new LEDManager(D12,10000); +LEDManager *l3r = new LEDManager(D8,10000); +LEDManager *l3g = new LEDManager(D9,10000); +LEDManager *l3b = new LEDManager(D10,10000); int main() { @@ -26,22 +26,39 @@ int time = timer.read_us(); - + DigitalIn button(USER_BUTTON); + while(1) { time = timer.read_us(); - led1->processLED(time); - led2->processLED(time); - led3->processLED(time); - led4->processLED(time); - led5->processLED(time); - led6->processLED(time); - led7->processLED(time); - led8->processLED(time); - led9->processLED(time); + l1g->processLED(time); + l1b->processLED(time); + l1r->processLED(time); + l2r->processLED(time); + l2g->processLED(time); + l2b->processLED(time); + l3r->processLED(time); + l3g->processLED(time); + l3b->processLED(time); + + if(button == 0){ + l1g->setFadeUpdatePeriod(l1g->getFadeUpdatePeriod() + 1000); + l2g->setFadeUpdatePeriod(l2g->getFadeUpdatePeriod() + 1000); + l3g->setFadeUpdatePeriod(l3g->getFadeUpdatePeriod() + 1000); + + l1b->setFadeUpdatePeriod(l1b->getFadeUpdatePeriod() + 1500); + l2b->setFadeUpdatePeriod(l2b->getFadeUpdatePeriod() + 1500); + l3b->setFadeUpdatePeriod(l3b->getFadeUpdatePeriod() + 1500); + + l3r->setActive(!l3r->getActiveness()); + while(button != 1); + } + + } } +