Example of defining a custom class

Dependencies:   mbed

Files at this revision

API Documentation at this revision

Comitter:
bjo3rn
Date:
Wed Sep 23 20:39:45 2015 +0000
Parent:
0:cdc3209dbb53
Commit message:
had green and blue flipped; fixed.

Changed in this revision

main.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/main.cpp	Wed Sep 23 20:24:41 2015 +0000
+++ b/main.cpp	Wed Sep 23 20:39:45 2015 +0000
@@ -15,7 +15,7 @@
     
     //set red, green, blue of on-board LED
     // r,g,b range from 0.0(off) to 1.0(full on)
-    void setColor(float r, float b, float g){
+    void setColor(float r, float g, float b){
         PwmOut redPin(LED_RED);
         PwmOut greenPin(LED_GREEN);
         PwmOut bluePin(LED_BLUE);
@@ -34,7 +34,7 @@
     while(1) {
         myLed.setColor(1.0, 0.0, 0.0); //call the member function setColor() - this is red
         wait(0.2);
-        myLed.setColor(0.0, 0.0, 1.0); //this is green
+        myLed.setColor(0.0, 1.0, 0.0); //this is green
         wait(0.2);
     }
 }