![](/media/cache/profiles/01e5405ccd7d3efa1fd033aa7b7489e9.jpg.50x50_q85.jpg)
Simple demo for MultipinRGB lib.
Dependencies: MultipinRGB max32630fthr
Diff: main.cpp
- Revision:
- 2:6a33adb8bf65
- Parent:
- 1:e10e0ccddca1
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