Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 1:a5fcf4e7055a, committed 2015-10-07
- Comitter:
- dwijaybane
- Date:
- Wed Oct 07 12:16:41 2015 +0000
- Parent:
- 0:573d4c6e63ac
- Commit message:
- comments updated
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Tue Oct 06 06:24:20 2015 +0000
+++ b/main.cpp Wed Oct 07 12:16:41 2015 +0000
@@ -1,25 +1,27 @@
-#include "mbed.h"
+#include "mbed.h" // Basic Library required for onchip peripherals
-PwmOut r (p23);
-PwmOut g (p24);
-PwmOut b (p25);
+/* Create Objects */
+PwmOut r (p23); // Create PWM object r for Red LED pin p23
+PwmOut g (p24); // Create PWM object g for Green LED pin p24
+PwmOut b (p25); // Create PWM object b for Blue LED pin p25
+/* Main Program */
int main()
{
- r.period(0.001);
+ r.period(0.001); // Periods in seconds which is 1KHz PWM freq
while(1) {
- r = 0;
- g = 1;
+ r = 0; // Display Red
+ g = 1; // 1 is lowest intensity
+ b = 1; // blue is also off
+ wait (0.5); // 500 ms delay
+ r = 1;
+ g = 0; // Display green
b = 1;
- wait (0.5);
- r = 1;
- g = 0;
- b = 1;
- wait (0.5);
+ wait (0.5); // 500 ms delay
r = 1;
g = 1;
- b = 0;
- wait (0.5);
+ b = 0; // Display blue
+ wait (0.5); // 500 ms delay
}
}
\ No newline at end of file