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.
Fork of hackspace_awesomeness by
Revision 2:2537a40d2ac8, committed 2014-07-12
- Comitter:
- tony1tf
- Date:
- Sat Jul 12 15:04:56 2014 +0000
- Parent:
- 1:8bd923cbd0e5
- Commit message:
- pwm ext led for kl25
Changed in this revision
| main.cpp | Show annotated file Show diff for this revision Revisions of this file |
--- a/main.cpp Sat Jul 12 13:55:56 2014 +0000
+++ b/main.cpp Sat Jul 12 15:04:56 2014 +0000
@@ -1,27 +1,30 @@
#include "mbed.h"
+// for kl25 external 3 colour LED
+PwmOut redpwm(D5);
+PwmOut greenpwm(D6);
+PwmOut blue(D7)
+int main()
+{
+ int i;
+ redpwm.period_ms(10);
+ greenpwm.period_ms(10);
+ bluepwm.period_ms(10);
-DigitalOut redLED(LED1);
-DigitalOut greenLED(LED2);
-DigitalOut blueLED(LED3);
-int main() {
- redLED = 1;
- greenLED = 1;
- blueLED = 1;
+// printf("pwm set to %.2f %%\n", mypwm.read() * 100);
+
while(1) {
- redLED = 0;
- wait(2.0);
- redLED = 1;
- wait(0.2);
-
- greenLED = 0;
- wait(2.0);
- greenLED = 1;
- wait(0.2);
-
- blueLED = 0;
- wait(2.0);
- blueLED = 1;
- wait(0.2);
- }
-}
+ for (i=0; i<11; i++) {
+ redpwm.pulsewidth_ms(i);
+ wait(0.1);
+ }
+ for (i=0; i<11; i++) {
+ greenpwm.pulsewidth_ms(i);
+ wait(0.1);
+ }
+ for (i=0; i<11; i++) {
+ bluepwm.pulsewidth_ms(i);
+ wait(0.1);
+ }
+
+
