Continuously vary LED brightness between completely dark and fully lite.

Files at this revision

API Documentation at this revision

Comitter:
sitti
Date:
Thu Dec 30 04:22:45 2010 +0000
Parent:
0:26c09c4aba81
Commit message:
2010-12-29 Remove a member variable and revise the example.

Changed in this revision

Glowing.cpp Show annotated file Show diff for this revision Revisions of this file
Glowing.h Show annotated file Show diff for this revision Revisions of this file
--- a/Glowing.cpp	Wed Dec 29 03:32:39 2010 +0000
+++ b/Glowing.cpp	Thu Dec 30 04:22:45 2010 +0000
@@ -7,9 +7,8 @@
     s_port          = new PwmOut(pin);
     s_steps         = steps;
     s_step_offset   = offset;
-    c_circle        = 2*acos(-1.0);    // 2 PI
     c_step_time     = period/steps;
-    c_step_gradient = c_circle/steps;
+    c_step_gradient = 2*acos(-1.0)/steps; // 2 PI/steps
     s_running       = false;
 }
 
--- a/Glowing.h	Wed Dec 29 03:32:39 2010 +0000
+++ b/Glowing.h	Thu Dec 30 04:22:45 2010 +0000
@@ -35,7 +35,7 @@
  *  Example:
  *  @code
  *  #include "Glowing.h"
- *  // Method A use LED1, run full cycle in 2 seconds in
+ *  // Run full cycle in 2 seconds in
  *  // 500 steps and begins with step 100
  *  {
  *      Glowing *glow = new Glowing(LED1, 2.0, 500, 100);
@@ -44,14 +44,6 @@
  *      glow->Stop();
  *  }
  *
- *  // Method B use LED2, run full cycle in 3 seconds in
- *  // 100 step (default) and begins with step 0 (default).
- *  {
- *      Glowing led(LED2, 3.0);
- *      led.Start();
- *      . . .
- *      led.Stop();
- *  }
  *  @endcode
  *
  */
@@ -90,7 +82,6 @@
     int         s_next_v;
     bool        s_running;
 
-    float       c_circle;
     float       c_step_time;
     float       c_step_gradient;