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
main.cpp
- Committer:
- dwijaybane
- Date:
- 2015-10-07
- Revision:
- 1:a5fcf4e7055a
- Parent:
- 0:573d4c6e63ac
File content as of revision 1:a5fcf4e7055a:
#include "mbed.h" // Basic Library required for onchip peripherals
/* 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); // Periods in seconds which is 1KHz PWM freq
while(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); // 500 ms delay
r = 1;
g = 1;
b = 0; // Display blue
wait (0.5); // 500 ms delay
}
}