Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: EthernetInterfacePlusHostname RdWebServer mbed-rtos mbed
EffectSmooth.h@0:887096209439, 2015-08-18 (annotated)
- Committer:
- Bobty
- Date:
- Tue Aug 18 16:03:29 2015 +0000
- Revision:
- 0:887096209439
Initial - unchanged since 2013
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| Bobty | 0:887096209439 | 1 | // Smooth transition effect |
| Bobty | 0:887096209439 | 2 | #include "Effect.h" |
| Bobty | 0:887096209439 | 3 | #include "colourconverters.h" |
| Bobty | 0:887096209439 | 4 | |
| Bobty | 0:887096209439 | 5 | class EffectSmooth : public virtual Effect |
| Bobty | 0:887096209439 | 6 | { |
| Bobty | 0:887096209439 | 7 | private: |
| Bobty | 0:887096209439 | 8 | int genCount; |
| Bobty | 0:887096209439 | 9 | ledstrip* pLedStrip; |
| Bobty | 0:887096209439 | 10 | HsvColor curHsv; |
| Bobty | 0:887096209439 | 11 | |
| Bobty | 0:887096209439 | 12 | public: |
| Bobty | 0:887096209439 | 13 | EffectSmooth(ledstrip* pleds) : Effect(), curHsv(0,0,0) |
| Bobty | 0:887096209439 | 14 | { |
| Bobty | 0:887096209439 | 15 | genCount = 0; |
| Bobty | 0:887096209439 | 16 | pLedStrip = pleds; |
| Bobty | 0:887096209439 | 17 | } |
| Bobty | 0:887096209439 | 18 | |
| Bobty | 0:887096209439 | 19 | virtual char* GetName() |
| Bobty | 0:887096209439 | 20 | { |
| Bobty | 0:887096209439 | 21 | return "smooth"; |
| Bobty | 0:887096209439 | 22 | } |
| Bobty | 0:887096209439 | 23 | |
| Bobty | 0:887096209439 | 24 | virtual void Init(char* argStr) |
| Bobty | 0:887096209439 | 25 | { |
| Bobty | 0:887096209439 | 26 | return; |
| Bobty | 0:887096209439 | 27 | genCount = 0; |
| Bobty | 0:887096209439 | 28 | pLedStrip->Clear(); |
| Bobty | 0:887096209439 | 29 | pLedStrip->ShowLeds(); |
| Bobty | 0:887096209439 | 30 | RgbColor startRGB(60,0,0); |
| Bobty | 0:887096209439 | 31 | curHsv = RgbToHsv(startRGB); |
| Bobty | 0:887096209439 | 32 | } |
| Bobty | 0:887096209439 | 33 | |
| Bobty | 0:887096209439 | 34 | virtual void NextGen() |
| Bobty | 0:887096209439 | 35 | { |
| Bobty | 0:887096209439 | 36 | return; |
| Bobty | 0:887096209439 | 37 | pLedStrip->Clear(); |
| Bobty | 0:887096209439 | 38 | RgbColor colrVal = HsvToRgb(curHsv); |
| Bobty | 0:887096209439 | 39 | pLedStrip->Fill(0,pLedStrip->GetNumLeds(),colrVal.r, colrVal.g, colrVal.b); |
| Bobty | 0:887096209439 | 40 | pLedStrip->ShowLeds(); |
| Bobty | 0:887096209439 | 41 | curHsv.h++; |
| Bobty | 0:887096209439 | 42 | } |
| Bobty | 0:887096209439 | 43 | |
| Bobty | 0:887096209439 | 44 | virtual void Stop() |
| Bobty | 0:887096209439 | 45 | { |
| Bobty | 0:887096209439 | 46 | return; |
| Bobty | 0:887096209439 | 47 | |
| Bobty | 0:887096209439 | 48 | pLedStrip->Clear(); |
| Bobty | 0:887096209439 | 49 | pLedStrip->ShowLeds(); |
| Bobty | 0:887096209439 | 50 | } |
| Bobty | 0:887096209439 | 51 | }; |
| Bobty | 0:887096209439 | 52 |