Hello World For FRDM-KL25Z

Dependencies:   mbed

Fork of HelloWorldFRDM-KL25Z by Mike Shaffer

Committer:
mshaffe4
Date:
Thu Apr 25 00:26:07 2013 +0000
Revision:
0:4364328db887
This is just a HelloWorld Program that make the rainbow lights go

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mshaffe4 0:4364328db887 1 #include "mbed.h"
mshaffe4 0:4364328db887 2
mshaffe4 0:4364328db887 3
mshaffe4 0:4364328db887 4 PwmOut r (LED_RED);
mshaffe4 0:4364328db887 5 PwmOut g (LED_GREEN);
mshaffe4 0:4364328db887 6 PwmOut b (LED_BLUE);
mshaffe4 0:4364328db887 7
mshaffe4 0:4364328db887 8 int main() {
mshaffe4 0:4364328db887 9 r.period(0.001);
mshaffe4 0:4364328db887 10 g.period(0.001);
mshaffe4 0:4364328db887 11 b.period(0.001);
mshaffe4 0:4364328db887 12
mshaffe4 0:4364328db887 13 while (true) {
mshaffe4 0:4364328db887 14 for (float i = 0.0; i < 1.0 ; i += 0.001) {
mshaffe4 0:4364328db887 15 float p = 3 * i;
mshaffe4 0:4364328db887 16 r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0);
mshaffe4 0:4364328db887 17 g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p);
mshaffe4 0:4364328db887 18 b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0);
mshaffe4 0:4364328db887 19 wait (0.0025);
mshaffe4 0:4364328db887 20 }
mshaffe4 0:4364328db887 21 }
mshaffe4 0:4364328db887 22 }