This loops through PWM outputs connected to the red and green LED.
Dependencies: mbed
Revision 5:10267572c71b, committed 2016-08-13
- Comitter:
- mattshuman
- Date:
- Sat Aug 13 08:39:25 2016 +0000
- Parent:
- 4:a8b0243f29b7
- Commit message:
- Updated the looping variables to i and j.
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r a8b0243f29b7 -r 10267572c71b main.cpp --- a/main.cpp Sat Aug 13 08:36:34 2016 +0000 +++ b/main.cpp Sat Aug 13 08:39:25 2016 +0000 @@ -12,7 +12,8 @@ while (true) { for (float i = 0.0f; i < 1.0f ; i += 0.001f) { float j = 2 * i; //Sweep the j value between 0 and 2, with .002 steps - if(p<1) + + if(j<1) r=j; else r=j-1; //Sweep the red LED 2 times during the loop, igorning the integer portion of the float number.