Hello World For FRDM-KL25Z

Dependencies:   mbed

Fork of HelloWorldFRDM-KL25ZPublic by Mike Shaffer

Committer:
MountainKing
Date:
Thu Dec 12 01:30:21 2013 +0000
Revision:
1:51e5ff6264c5
Parent:
0:4364328db887
Add the serial code, but with the fireware from mbed for KL25Z, the computer could not find CDC

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);
MountainKing 1:51e5ff6264c5 7 Serial pc(USBTX, USBRX);
mshaffe4 0:4364328db887 8
mshaffe4 0:4364328db887 9 int main() {
mshaffe4 0:4364328db887 10 r.period(0.001);
mshaffe4 0:4364328db887 11 g.period(0.001);
mshaffe4 0:4364328db887 12 b.period(0.001);
mshaffe4 0:4364328db887 13
mshaffe4 0:4364328db887 14 while (true) {
mshaffe4 0:4364328db887 15 for (float i = 0.0; i < 1.0 ; i += 0.001) {
mshaffe4 0:4364328db887 16 float p = 3 * i;
mshaffe4 0:4364328db887 17 r = 1.0 - ((p < 1.0) ? 1.0 - p : (p > 2.0) ? p - 2.0 : 0.0);
mshaffe4 0:4364328db887 18 g = 1.0 - ((p < 1.0) ? p : (p > 2.0) ? 0.0 : 2.0 - p);
mshaffe4 0:4364328db887 19 b = 1.0 - ((p < 1.0) ? 0.0 : (p > 2.0) ? 3.0 - p : p - 1.0);
mshaffe4 0:4364328db887 20 wait (0.0025);
MountainKing 1:51e5ff6264c5 21 pc.printf("Hello World");
mshaffe4 0:4364328db887 22 }
mshaffe4 0:4364328db887 23 }
mshaffe4 0:4364328db887 24 }