Simple demo for MultipinRGB lib.
Dependencies: MultipinRGB max32630fthr
Revision 2:6a33adb8bf65, committed 2017-03-28
- Comitter:
- j3
- Date:
- Tue Mar 28 23:38:44 2017 +0000
- Parent:
- 1:e10e0ccddca1
- Commit message:
- replaced main
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
diff -r e10e0ccddca1 -r 6a33adb8bf65 main.cpp --- a/main.cpp Tue Mar 28 23:36:03 2017 +0000 +++ b/main.cpp Tue Mar 28 23:38:44 2017 +0000 @@ -40,20 +40,24 @@ MAX32630FTHR pegasus(MAX32630FTHR::VIO_3V3); -int main() +int main () { MultipinRGB leds(LED1, LED2, LED3); - - while(1) + float redDutyCycle(0.5F), grnDutyCycle(0.0F), bluDutyCycle(0.0F), temp; + + while(1) { - leds.toggleLed(MultipinRGB::Red); + leds.writeLeds(redDutyCycle, grnDutyCycle, bluDutyCycle); + + printf("RGB Duty Cycles = %3.1f, %3.1f, %3.1f\r\n", + redDutyCycle, grnDutyCycle, bluDutyCycle); + + //shift r->g->b->r + temp = bluDutyCycle; + bluDutyCycle = grnDutyCycle; + grnDutyCycle = redDutyCycle; + redDutyCycle = temp; + wait(0.25); - leds.toggleLed(MultipinRGB::Red); - leds.toggleLed(MultipinRGB::Green); - wait(0.25); - leds.toggleLed(MultipinRGB::Green); - leds.toggleLed(MultipinRGB::Blue); - wait(0.25); - leds.toggleLed(MultipinRGB::Blue); } } \ No newline at end of file